diff options
Diffstat (limited to 'gcc/testsuite')
78 files changed, 1405 insertions, 308 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d90eca58bca..02f87d058ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,167 @@ +2009-06-16 Martin Jambor <mjambor@suse.cz> + + * testsuite/gcc.c-torture/compile/pr40432.c: New file. + +2009-06-16 Martin Jambor <mjambor@suse.cz> + + * testsuite/gfortran.fortran-torture/compile/pr40413.f90: New file. + +2009-06-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/36947 + PR fortran/40039 + * gfortran.dg/dummy_procedure_1.f90: Extended test case. + * gfortran.dg/interface_20.f90: Modified error messages. + * gfortran.dg/interface_21.f90: Ditto. + * gfortran.dg/interface_26.f90: Ditto. + * gfortran.dg/interface_27.f90: Ditto. + * gfortran.dg/interface_28.f90: Extended test case. + * gfortran.dg/interface_29.f90: New. + * gfortran.dg/proc_decl_7.f90: Modified error messages. + * gfortran.dg/proc_decl_8.f90: Ditto. + * gfortran.dg/proc_ptr_11.f90: Ditto. + * gfortran.dg/proc_ptr_15.f90: Ditto. + +2009-06-16 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/vect-outer-4g.c: Don't look for pattern not allowed + printing. + * gcc.dg/vect/vect-outer-4k.c, gcc.dg/vect/vect-outer-4l.c, + gcc.dg/vect/vect-outer-4f.c: Likewise. + * gcc.dg/vect/vect-nest-cycle-1.c: New test. + * gcc.dg/vect/vect-nest-cycle-2.c, gcc.dg/vect/vect-nest-cycle-3.c: + Likewise. + * gcc.dg/vect/vect-outer-1a.c: Fail because of strided access in outer + loop. + +2009-06-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/40383 + * gfortran.dg/bounds_check_strlen_8.f90: New test. + +2009-06-15 Ian Lance Taylor <iant@google.com> + + * gcc.dg/Wjump-misses-init-1.c: New testcase. + * gcc.dg/Wjump-misses-init-2.c: New testcase. + * gcc.dg/c99-vla-jump-5.c: Adjust expected error messages. + Recognize new notes. + * gcc.dg/stmt-expr-label-2.c: Likewise. + * gcc.dg/c99-vla-jump-1.c: Recognize new notes. Fix column + numbers. + * gcc.dg/c99-vla-jump-2.c: Recognize new notes. + * gcc.dg/c99-vla-jump-3.c: Recognize new notes. + * gcc.dg/c99-vla-jump-4.c: Likewise. + * gcc.dg/stmt-expr-label-1.c: Likewise. + * gcc.dg/stmt-expr-label-3.c: Likewise. + * gcc.dg/vla-8.c: Likewise. Move error message to different + line. + +2009-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * gcc.dg/torture/builtin-math-6.c: Robustify and fix clog cases. + +2009-06-15 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/builtin-object-size-7.c: New test. + +2009-06-15 Jakub Jelinek <jakub@redhat.com> + + PR testsuite/40426 + * lib/gcc-dg.exp (gcc-dg-debug-runtest): For type -gdwarf-2 and + level != "" use separate -gdwarf-2 -g${level} options instead of + -gdwarf-2${level}. + * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Likewise. + * gfortran.dg/debug/pr37738.f: Also skip if -gdwarf-2 -g1. + * gfortran.dg/debug/pr35154-dwarf2.f: Likewise. + +2009-06-15 Rafael Avila de Espindola <espindola@google.com> + + * g++.dg/abi/mangle11.C: Update warning line. + * g++.dg/abi/mangle12.C: Update warning line. + * g++.dg/abi/mangle17.C: Update warning line. + * g++.dg/abi/mangle20-2.C: Update warning line. + +2009-06-14 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + * gcc.dg/optimize-bswap-1.c: Split into these two: + * gcc.dg/optimize-bswapsi-1.c: New testcase. + * gcc.dg/optimize-bswapdi-1.c: New testcase. + +2009-06-14 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + * gcc.dg/optimize-bswap-1.c: New testcase. + +2009-06-14 Richard Guenther <rguenther@suse.de> + + PR middle-end/40389 + * g++.dg/torture/pr40389.C: New testcase. + +2009-06-13 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/40421 + * gfortran.fortran-torture/compile/pr40421.f: New testcase. + +2009-06-12 Aldy Hernandez <aldyh@redhat.com> + + * gcc.dg/old-style-prom-3.c: Add column info. + * gcc.dg/overflow-warn-1.c + * gcc.dg/gomp/pr27415.c + * gcc.dg/gomp/for-1.c: Same. + * gcc.dg/enum-compat-1.c: Same. + * gcc.dg/c99-tag-3.c: Same. + * gcc.dg/Wredundant-decls-2.c: Same. + * gcc.dg/func-ptr-conv-1.c: Same. + * gcc.dg/asm-wide-1.c: Same. + * gcc.dg/nofixed-point-2.c: Same. + * gcc.dg/cpp/line3.c: Same. + * gcc.dg/array-10.c: Same. + * gcc.dg/c99-vla-jump-1.c: Same. + * gcc.dg/pr20368-1.c: Same. + * gcc.dg/Wshadow-3.c: Same. + * gcc.dg/c90-const-expr-8.c: Same. + * gcc.dg/label-decl-2.c: Same. + * gcc.dg/dremf-type-compat-2.c: Same. + * gcc.dg/c90-const-expr-5.c: Same. + * gcc.dg/builtins-30.c: Same. + * gcc.dg/Warray-bounds.c: Same. + * gcc.dg/Wcxx-compat-2.c: Same. + * gcc.dg/tree-ssa/col-1.c: Same. + * gcc.dg/old-style-prom-2.c: Same. + * gcc.dg/cast-function-1.c: Same. + * gcc.dg/pr15698-1.c: Same. + * gcc.dg/dremf-type-compat-3.c: Same. + * gcc.dg/vla-8.c: Same. + * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct + line. + * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. + * gcc.dg/old-style-prom-3.c: Check for error on the correct line. + * gcc.dg/enum-compat-1.c: Same. + * gcc.dg/dremf-type-compat-2.c: Same. + * gcc.dg/old-style-prom-2.c: Same. + * gcc.dg/pr15698-1.c: Same. + * gcc.dg/pr20368-1.c: Same. + * gcc.dg/dremf-type-compat-3.c: Same. + * gcc.dg/builtins-30.c: Same. Test for columns. + +2009-06-12 Janus Weil <janus@gcc.gnu.org> + + PR fortran/40176 + * gfortran.dg/proc_decl_1.f90: Extended. + +2009-06-12 Ian Lance Taylor <iant@google.com> + + * gcc.dg/Wcxx-compat-13.c: New testcase. + +2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR tree-opt/38865 + * gcc.dg/tree-ssa/fre-vce-1.c + +2009-06-12 H.J. Lu <hongjiu.lu@intel.com> + + PR testsuite/40384 + * gcc.dg/tree-ssa/prefetch-5.c: Add --param min-insn-to-prefetch-ratio=5. + 2009-06-12 Joey Ye <joey.ye@intel.com> H.J. Lu <hongjiu.lu@intel.com> diff --git a/gcc/testsuite/g++.dg/abi/mangle11.C b/gcc/testsuite/g++.dg/abi/mangle11.C index 6d09b51a6a1..a049a956671 100644 --- a/gcc/testsuite/g++.dg/abi/mangle11.C +++ b/gcc/testsuite/g++.dg/abi/mangle11.C @@ -1,10 +1,10 @@ // { dg-options "-Wabi -fabi-version=1" } template <typename Q> -void f (typename Q::X) {} // { dg-warning "mangle" } +void f (typename Q::X) {} struct S { typedef int X; }; -template void f<S> (int); +template void f<S> (int); // { dg-warning "mangle" } diff --git a/gcc/testsuite/g++.dg/abi/mangle12.C b/gcc/testsuite/g++.dg/abi/mangle12.C index a3bd9ff6fa7..7176fcd28dc 100644 --- a/gcc/testsuite/g++.dg/abi/mangle12.C +++ b/gcc/testsuite/g++.dg/abi/mangle12.C @@ -1,11 +1,11 @@ // { dg-options "-Wabi -fabi-version=1" } template <template <typename> class Q> -void f (typename Q<int>::X) {} // { dg-warning "mangle" } +void f (typename Q<int>::X) {} template <typename Q> struct S { typedef int X; }; -template void f<S> (int); +template void f<S> (int); // { dg-warning "mangle" } diff --git a/gcc/testsuite/g++.dg/abi/mangle17.C b/gcc/testsuite/g++.dg/abi/mangle17.C index 134b976a271..0a5fe9a60e8 100644 --- a/gcc/testsuite/g++.dg/abi/mangle17.C +++ b/gcc/testsuite/g++.dg/abi/mangle17.C @@ -4,8 +4,8 @@ enum E { e = 3 }; template <int I> struct S {}; -template <int I> void f (S<I + e + int (3.7)>) {} // { dg-warning "mangle" } -template void f<7>(S<7 + e + int (3.7)>); +template <int I> void f (S<I + e + int (3.7)>) {} +template void f<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" } -template <int I> void g (S<I + e + int (3.7)>) {} // { dg-warning "mangle" } -template void g<7>(S<7 + e + int (3.7)>); +template <int I> void g (S<I + e + int (3.7)>) {} +template void g<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" } diff --git a/gcc/testsuite/g++.dg/abi/mangle20-2.C b/gcc/testsuite/g++.dg/abi/mangle20-2.C index 38ac52371ab..bf3d189bf0c 100644 --- a/gcc/testsuite/g++.dg/abi/mangle20-2.C +++ b/gcc/testsuite/g++.dg/abi/mangle20-2.C @@ -7,10 +7,10 @@ // PR 9043 // mangled array types in templates -template <int I> void f(int (*)[2]) {} // { dg-warning "mangled name" } +template <int I> void f(int (*)[2]) {} template <int I> void g(int (*)[I+2]) {} -template void f<1>(int (*)[2]); +template void f<1>(int (*)[2]); // { dg-warning "mangled name" } // { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } } template void g<1>(int (*)[3]); // { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } } diff --git a/gcc/testsuite/g++.dg/torture/pr40389.C b/gcc/testsuite/g++.dg/torture/pr40389.C new file mode 100644 index 00000000000..e3ceb1238b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr40389.C @@ -0,0 +1,84 @@ +/* { dg-do run } */ + +template <typename V> struct S +{ + V *f, *l; + __attribute__ ((noinline)) S (void) { f = 0, l = 0; } + void foo (V *x) + { + if (x->p != 0) + x->p->n = x->n; + else + f = x->n; + if (x->n != 0) + x->n->p = x->p; + else + l = x->p; + } + __attribute__ ((noinline)) void bar (V *x) + { + x->n = 0; + x->p = l; + if (l != 0) + l->n = x; + else + f = x; + l = x; + } +}; + +struct H; + +struct A +{ + S <H> k; +}; + +struct H +{ + A *a; + H *p, *n; + __attribute__ ((noinline)) H (void) { p = 0, n = 0, a = 0; } + __attribute__ ((noinline)) H (A *b) : a (b) + { + p = 0; + n = 0; + if (a != 0) + a->k.bar (this); + } + __attribute__ ((noinline)) H (const H &h) : a (h.a) + { + p = 0; + n = 0; + if (a != 0) + a->k.bar (this); + } + ~H (void) { if (a != 0) a->k.foo (this); } + H &operator= (const H &o) + { + if (a != 0 || &o == this) + __builtin_abort (); + a = o.a; + if (a != 0) + a->k.bar (this); + return *this; + } +}; + +__attribute__ ((noinline)) +H baz (void) +{ + return H (new A); +} + +H g; + +int +main (void) +{ + g = baz (); + if (g.a->k.f != &g) + __builtin_abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40432.c b/gcc/testsuite/gcc.c-torture/compile/pr40432.c new file mode 100644 index 00000000000..767f5949887 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40432.c @@ -0,0 +1,17 @@ +/* Test that SRA produces valid gimple when handling both type punning by means + of VCE and creating an access to a union. */ + +union U { + struct something *sth; + void *nothing; +}; + +void +foo (union U *target, void *p) +{ + union U u; + + u.nothing = p; + *target = u; + return; +} diff --git a/gcc/testsuite/gcc.dg/Warray-bounds.c b/gcc/testsuite/gcc.dg/Warray-bounds.c index ac384e6bb2f..44120392c73 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds.c @@ -18,40 +18,40 @@ int* f(void) { int c[10]; } c; - a[-1] = 0; /* { dg-warning "array subscript" } */ + a[-1] = 0; /* { dg-warning "6:array subscript" } */ a[ 0] = 0; a[ 1] = 0; a[ 9] = 0; - a[10] = 0; /* { dg-warning "array subscript" } */ - a[11] = 0; /* { dg-warning "array subscript" } */ - a[2 * n() - 11] = 1; /* { dg-warning "array subscript" } */ + a[10] = 0; /* { dg-warning "6:array subscript" } */ + a[11] = 0; /* { dg-warning "6:array subscript" } */ + a[2 * n() - 11] = 1; /* { dg-warning "6:array subscript" } */ a[2 * n() - 10] = 1; a[2 * n() - 1] = 1; - a[2 * n() - 0] = 1; /* { dg-warning "array subscript" } */ + a[2 * n() - 0] = 1; /* { dg-warning "6:array subscript" } */ - b[-1] = 0; /* { dg-warning "array subscript" } */ + b[-1] = 0; /* { dg-warning "6:array subscript" } */ b[ 0] = 0; b[ 1] = 0; b[ 9] = 0; - b[10] = 0; /* { dg-warning "array subscript" } */ - b[11] = 0; /* { dg-warning "array subscript" } */ - b[2 * n() - 11] = 1; /* { dg-warning "array subscript" } */ + b[10] = 0; /* { dg-warning "6:array subscript" } */ + b[11] = 0; /* { dg-warning "6:array subscript" } */ + b[2 * n() - 11] = 1; /* { dg-warning "6:array subscript" } */ b[2 * n() - 10] = 1; b[2 * n() - 1] = 1; b[2 * n() - 0] = 1; /* { dg-warning "array subscript" } */ - c.c[-1] = 0; /* { dg-warning "array subscript" } */ + c.c[-1] = 0; /* { dg-warning "8:array subscript" } */ c.c[ 0] = 0; c.c[ 1] = 0; c.c[ 9] = 0; - c.c[10] = 0; /* { dg-warning "array subscript" } */ - c.c[11] = 0; /* { dg-warning "array subscript" } */ - c.c[2 * n() - 11] = 1; /* { dg-warning "array subscript" } */ + c.c[10] = 0; /* { dg-warning "8:array subscript" } */ + c.c[11] = 0; /* { dg-warning "8:array subscript" } */ + c.c[2 * n() - 11] = 1; /* { dg-warning "8:array subscript" } */ c.c[2 * n() - 10] = 1; c.c[2 * n() - 1] = 1; - c.c[2 * n() - 0] = 1; /* { dg-warning "array subscript" } */ + c.c[2 * n() - 0] = 1; /* { dg-warning "8:array subscript" } */ g(&a[8]); g(&a[9]); @@ -86,7 +86,7 @@ int* f(void) { c.c[-1] = 0; for (i = 20; i < 30; ++i) - a[i] = 1; /* { dg-warning "array subscript" } */ + a[i] = 1; /* { dg-warning "15:array subscript" } */ return a; } diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-13.c b/gcc/testsuite/gcc.dg/Wcxx-compat-13.c new file mode 100644 index 00000000000..18823964460 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-13.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ + +int and; /* { dg-warning "operator" } */ +int and_eq; /* { dg-warning "operator" } */ +int bitand; /* { dg-warning "operator" } */ +int bitor; /* { dg-warning "operator" } */ +int compl; /* { dg-warning "operator" } */ +int not; /* { dg-warning "operator" } */ +int not_eq; /* { dg-warning "operator" } */ +int or; /* { dg-warning "operator" } */ +int or_eq; /* { dg-warning "operator" } */ +int xor; /* { dg-warning "operator" } */ +int xor_eq; /* { dg-warning "operator" } */ + +#define M1 and /* { dg-warning "operator" } */ +#define M2 and_eq /* { dg-warning "operator" } */ +#define M3 bitand /* { dg-warning "operator" } */ +#define M4 bitor /* { dg-warning "operator" } */ +#define M5 compl /* { dg-warning "operator" } */ +#define M6 not /* { dg-warning "operator" } */ +#define M7 not_eq /* { dg-warning "operator" } */ +#define M8 or /* { dg-warning "operator" } */ +#define M9 or_eq /* { dg-warning "operator" } */ +#define M10 xor /* { dg-warning "operator" } */ +#define M11 xor_eq /* { dg-warning "operator" } */ diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-2.c b/gcc/testsuite/gcc.dg/Wcxx-compat-2.c index a091c6dd8b5..14edc1a4215 100644 --- a/gcc/testsuite/gcc.dg/Wcxx-compat-2.c +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-2.c @@ -1,36 +1,36 @@ /* { dg-options "-Wc++-compat" } */ _Bool foo; /* This is okay. */ -int bool; /* { dg-warning "keyword" } */ -int catch; /* { dg-warning "keyword" } */ -int char16_t; /* { dg-warning "keyword" } */ -int char32_t; /* { dg-warning "keyword" } */ -int class; /* { dg-warning "keyword" } */ -int const_cast; /* { dg-warning "keyword" } */ -int decltype; /* { dg-warning "keyword" } */ -int delete; /* { dg-warning "keyword" } */ -int dynamic_cast; /* { dg-warning "keyword" } */ -int explicit; /* { dg-warning "keyword" } */ -int export; /* { dg-warning "keyword" } */ -int false; /* { dg-warning "keyword" } */ -int friend; /* { dg-warning "keyword" } */ -int mutable; /* { dg-warning "keyword" } */ -int namespace; /* { dg-warning "keyword" } */ -int new; /* { dg-warning "keyword" } */ -int operator; /* { dg-warning "keyword" } */ -int private; /* { dg-warning "keyword" } */ -int protected; /* { dg-warning "keyword" } */ -int public; /* { dg-warning "keyword" } */ -int reinterpret_cast; /* { dg-warning "keyword" } */ -int static_assert; /* { dg-warning "keyword" } */ -int static_cast; /* { dg-warning "keyword" } */ -int template; /* { dg-warning "keyword" } */ -int this; /* { dg-warning "keyword" } */ -int throw; /* { dg-warning "keyword" } */ -int true; /* { dg-warning "keyword" } */ -int try; /* { dg-warning "keyword" } */ -int typename; /* { dg-warning "keyword" } */ -int typeid; /* { dg-warning "keyword" } */ -int using; /* { dg-warning "keyword" } */ -int virtual; /* { dg-warning "keyword" } */ +int bool; /* { dg-warning "5:keyword" } */ +int catch; /* { dg-warning "5:keyword" } */ +int char16_t; /* { dg-warning "5:keyword" } */ +int char32_t; /* { dg-warning "5:keyword" } */ +int class; /* { dg-warning "5:keyword" } */ +int const_cast; /* { dg-warning "5:keyword" } */ +int decltype; /* { dg-warning "5:keyword" } */ +int delete; /* { dg-warning "5:keyword" } */ +int dynamic_cast; /* { dg-warning "5:keyword" } */ +int explicit; /* { dg-warning "5:keyword" } */ +int export; /* { dg-warning "5:keyword" } */ +int false; /* { dg-warning "5:keyword" } */ +int friend; /* { dg-warning "5:keyword" } */ +int mutable; /* { dg-warning "5:keyword" } */ +int namespace; /* { dg-warning "5:keyword" } */ +int new; /* { dg-warning "5:keyword" } */ +int operator; /* { dg-warning "5:keyword" } */ +int private; /* { dg-warning "5:keyword" } */ +int protected; /* { dg-warning "5:keyword" } */ +int public; /* { dg-warning "5:keyword" } */ +int reinterpret_cast; /* { dg-warning "5:keyword" } */ +int static_assert; /* { dg-warning "5:keyword" } */ +int static_cast; /* { dg-warning "5:keyword" } */ +int template; /* { dg-warning "5:keyword" } */ +int this; /* { dg-warning "5:keyword" } */ +int throw; /* { dg-warning "5:keyword" } */ +int true; /* { dg-warning "5:keyword" } */ +int try; /* { dg-warning "5:keyword" } */ +int typename; /* { dg-warning "5:keyword" } */ +int typeid; /* { dg-warning "5:keyword" } */ +int using; /* { dg-warning "5:keyword" } */ +int virtual; /* { dg-warning "5:keyword" } */ int wchar_t; diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c b/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c new file mode 100644 index 00000000000..86117f1f2f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c @@ -0,0 +1,156 @@ +/* { dg-do compile } */ +/* { dg-options "-Wjump-misses-init" } */ +int +f1 (int a) +{ + if (a > 0) + { + int i = 7; /* { dg-message "here" } */ + lab: /* { dg-message "here" } */ + return a; + } + else + { + if (a < 0) + goto lab; /* { dg-warning "jump" } */ + return 1; + } +} + +int +f2 (int a) +{ + if (a > 0) + { + if (a < 0) + goto lab; /* { dg-warning "jump" } */ + return 1; + } + else + { + int i = 7; /* { dg-message "here" } */ + lab: /* { dg-message "here" } */ + return a; + } +} + +int +f3 (int a) +{ + if (a > 0) + { + static int i = 7; + lab: + return a; + } + else + { + if (a < 0) + goto lab; + return 1; + } +} + +int +f4 (int a) +{ + if (a > 0) + { + if (a < 0) + goto lab; + return 1; + } + else + { + static int i = 7; + lab: + return a; + } +} + +int +f5 (int a) +{ + if (a > 0) + { + int b = 1; + if (a < 0) + goto lab; + } + lab: + return a; +} + +int +f6 (int a) +{ + if (a > 0) + { + lab: + return a; + } + else + { + int b = 1; + goto lab; + } +} + +int +f7 (int a) +{ + switch (a) /* { dg-message "switch" } */ + { + int b = 1; /* { dg-message "here" } */ + + case 1: /* { dg-warning "jump" } */ + return a; + } +} + +int +f8 (int a) +{ + switch (a) /* { dg-message "switch" } */ + { + int b = 1; /* { dg-message "here" } */ + + case 1: /* { dg-warning "jump" } */ + goto lab; + } + lab: + return a; +} + +int +f9 (int a) +{ + switch (a) + { + case 0: + { + int b = 1; + return b; + } + case 1: + return a; + } +} + +int +f10 (int a) +{ + switch (a) + { + case 0: + { + int b = 1; + goto lab; + } + + case 1: + goto lab; + } + lab: + return a; +} diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c b/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c new file mode 100644 index 00000000000..042c02aa7bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-Wjump-misses-init -std=c99" } */ +extern void f1 (); +int +f2 (int a) +{ + switch (a) /* { dg-message "switch" } */ + { + case 1: + f1 (); + int v2 = 3; /* { dg-message "here" } */ + case 2: /* { dg-warning "jump" } */ + if (v2 == 7) + f1 (); + } + return 0; +} + +int +f3 (int i) +{ + if (i) + goto bad; /* { dg-warning "jump" } */ + int a = f2 (i); /* { dg-message "here" } */ + bad: /* { dg-message "here" } */ + return a; +} + +int +f4 (int a) +{ + switch (a) + { + case 1: + f1 (); + static int v2 = 3; + case 2: + if (v2 == 7) + f1 (); + } + return 0; +} + +int +f5 (int i) +{ + if (i) + goto bad; + static int a = 6; + bad: + return a; +} diff --git a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c index 89f57b427c6..27c8e5d9f7d 100644 --- a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c +++ b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c @@ -2,22 +2,22 @@ /* { dg-do compile } */ /* { dg-options "-Wredundant-decls" } */ -int j = 5; /* { dg-message "note: previous" } */ -int j; /* { dg-warning "redundant" } */ +int j = 5; /* { dg-message "5:note: previous" } */ +int j; /* { dg-warning "5:redundant" } */ static int k; -static int k = 5; /* { dg-message "note: previous" } */ -static int k; /* { dg-warning "redundant" } */ +static int k = 5; /* { dg-message "12:note: previous" } */ +static int k; /* { dg-warning "12:redundant" } */ -static int l = 5; /* { dg-message "note: previous" } */ -static int l; /* { dg-warning "redundant" } */ +static int l = 5; /* { dg-message "12:note: previous" } */ +static int l; /* { dg-warning "12:redundant" } */ -static int m; /* { dg-message "note: previous" } */ -static int m; /* { dg-warning "redundant" } */ +static int m; /* { dg-message "12:note: previous" } */ +static int m; /* { dg-warning "12:redundant" } */ static int m = 5; -int n; /* { dg-message "note: previous" } */ -int n; /* { dg-warning "redundant" } */ +int n; /* { dg-message "5:note: previous" } */ +int n; /* { dg-warning "5:redundant" } */ int n = 5; static int o; diff --git a/gcc/testsuite/gcc.dg/Wshadow-3.c b/gcc/testsuite/gcc.dg/Wshadow-3.c index a7f06a26f96..b6d78b1d38b 100644 --- a/gcc/testsuite/gcc.dg/Wshadow-3.c +++ b/gcc/testsuite/gcc.dg/Wshadow-3.c @@ -1,21 +1,61 @@ -/* Test warnings for shadowing in function prototype scope: generally - useless but of use if the parameter is used within the scope. Bug - 529. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* PR middle-end/36902 Array bound warning with dead code after optimization */ /* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wshadow" } */ - -int v; /* { dg-warning "shadowed declaration" } */ -int f1(int v); -int f2(int v, int x[v]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f3(int v, int y[sizeof(v)]); /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f4(int v) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f5(int v, int x[v]) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f6(int x) { return 0; } -int f7(v) int v; { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f8(v, w) int v; int w[v]; { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f9(x) int x; { return 0; } -int f10(v) { return 0; } /* { dg-warning "declaration of 'v' shadows a global declaration" } */ -int f11(int a, int b(int a)); -int f12(int a, int b(int a, int x[a])); /* { dg-warning "declaration of 'a' shadows a parameter" } */ -/* { dg-warning "shadowed declaration" "outer parm" { target *-*-* } 20 } */ +/* { dg-options "-O2 -Warray-bounds -Wall -Wextra" } */ +typedef unsigned char __u8; +typedef unsigned short __u16; + +static inline unsigned char * +foo(unsigned char * to, const unsigned char * from, int n) +{ + switch ( n ) + { + case 3: + *to = *from; + break; + case 5: + to[4] = from [4]; + break; + } + return to; +} + +struct { + int size_of_select; + unsigned char pcr_select[4]; +} sel; + +int bar(void) +{ + static unsigned char buf[64]; + + sel.size_of_select = 3; + foo(buf, sel.pcr_select, sel.size_of_select); + + return 1; +} + + +static inline unsigned char * +foo2(unsigned char * to, const unsigned char * from, int n) +{ + switch ( n ) + { + case 3: + *to = *from; + break; + case 5: + to[63] = from [111]; /* { dg-warning "array subscript is above array bounds" } */ + break; + } + return to; +} + +int baz(void) +{ + static unsigned char buf[64]; + + sel.size_of_select = 5; + foo2(buf, sel.pcr_select, sel.size_of_select); + + return 1; +} diff --git a/gcc/testsuite/gcc.dg/array-10.c b/gcc/testsuite/gcc.dg/array-10.c index aab1538d5e1..3b4d512ba5a 100644 --- a/gcc/testsuite/gcc.dg/array-10.c +++ b/gcc/testsuite/gcc.dg/array-10.c @@ -6,28 +6,28 @@ int a; -int b0[a]; /* { dg-error "at file scope" } */ -int (*b1)[a]; /* { dg-error "at file scope" } */ +int b0[a]; /* { dg-error "5:at file scope" } */ +int (*b1)[a]; /* { dg-error "7:at file scope" } */ int (*b2())[a]; /* { dg-error "at file scope" } */ -struct b3 { int x[a]; }; /* { dg-error "at file scope" } */ -struct b4 { int (*x)[a]; }; /* { dg-error "at file scope" } */ +struct b3 { int x[a]; }; /* { dg-error "17:at file scope" } */ +struct b4 { int (*x)[a]; }; /* { dg-error "19:at file scope" } */ typeof (int [a]) b5; /* { dg-error "at file scope|outside of any function" } */ -int c0[(__SIZE_TYPE__)&a]; /* { dg-error "at file scope" } */ -int (*c1)[(__SIZE_TYPE__)&a]; /* { dg-error "at file scope" } */ -int (*c2())[(__SIZE_TYPE__)&a]; /* { dg-error "at file scope" } */ -struct c3 { int x[(__SIZE_TYPE__)&a]; }; /* { dg-error "at file scope" } */ -struct c4 { int (*x)[(__SIZE_TYPE__)&a]; }; /* { dg-error "at file scope" } */ -typeof (int [(__SIZE_TYPE__)&a]) c5; /* { dg-error "at file scope" } */ +int c0[(__SIZE_TYPE__)&a]; /* { dg-error "5:at file scope" } */ +int (*c1)[(__SIZE_TYPE__)&a]; /* { dg-error "7:at file scope" } */ +int (*c2())[(__SIZE_TYPE__)&a]; /* { dg-error "7:at file scope" } */ +struct c3 { int x[(__SIZE_TYPE__)&a]; }; /* { dg-error "17:at file scope" } */ +struct c4 { int (*x)[(__SIZE_TYPE__)&a]; }; /* { dg-error "19:at file scope" } */ +typeof (int [(__SIZE_TYPE__)&a]) c5; /* { dg-error "34:at file scope" } */ -int d0[1/0]; /* { dg-error "at file scope" } */ -/* { dg-warning "division by zero" "" { target *-*-* } 23 } */ -int (*d1)[1/0]; /* { dg-error "at file scope" } */ -/* { dg-warning "division by zero" "" { target *-*-* } 25 } */ -int (*d2())[1/0]; /* { dg-error "at file scope" } */ -/* { dg-warning "division by zero" "" { target *-*-* } 27 } */ -struct d3 { int x[1/0]; }; /* { dg-error "at file scope" } */ -/* { dg-warning "division by zero" "" { target *-*-* } 29 } */ -struct d4 { int (*x)[1/0]; }; /* { dg-error "at file scope" } */ -/* { dg-warning "division by zero" "" { target *-*-* } 31 } */ -typeof (int [1/0]) d5; /* { dg-error "at file scope" } */ +int d0[1/0]; /* { dg-error "5:at file scope" } */ +/* { dg-warning "9:division by zero" "" { target *-*-* } 23 } */ +int (*d1)[1/0]; /* { dg-error "7:at file scope" } */ +/* { dg-warning "12:division by zero" "" { target *-*-* } 25 } */ +int (*d2())[1/0]; /* { dg-error "7:at file scope" } */ +/* { dg-warning "14:division by zero" "" { target *-*-* } 27 } */ +struct d3 { int x[1/0]; }; /* { dg-error "17:at file scope" } */ +/* { dg-warning "20:division by zero" "" { target *-*-* } 29 } */ +struct d4 { int (*x)[1/0]; }; /* { dg-error "19:at file scope" } */ +/* { dg-warning "23:division by zero" "" { target *-*-* } 31 } */ +typeof (int [1/0]) d5; /* { dg-error "20:at file scope" } */ diff --git a/gcc/testsuite/gcc.dg/asm-wide-1.c b/gcc/testsuite/gcc.dg/asm-wide-1.c index a42271fd4b1..c14b19d3479 100644 --- a/gcc/testsuite/gcc.dg/asm-wide-1.c +++ b/gcc/testsuite/gcc.dg/asm-wide-1.c @@ -3,27 +3,27 @@ /* { dg-do compile } */ /* { dg-options "" } */ -int foo asm (L"bar"); /* { dg-error "wide string literal in 'asm'" } */ +int foo asm (L"bar"); /* { dg-error "14:wide string literal in 'asm'" } */ -asm (L"foo"); /* { dg-error "wide string literal in 'asm'" } */ +asm (L"foo"); /* { dg-error "6:wide string literal in 'asm'" } */ void f (void) { int x = 1; - asm (L"foo"); /* { dg-error "wide string literal in 'asm'" } */ + asm (L"foo"); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : - L"=g" (x)); /* { dg-error "wide string literal in 'asm'" } */ + L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : [x] - L"=g" (x)); /* { dg-error "wide string literal in 'asm'" } */ + L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : [x] "=g" (x), - L"=g" (x)); /* { dg-error "wide string literal in 'asm'" } */ + L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : : - L"g" (x)); /* { dg-error "wide string literal in 'asm'" } */ + L"g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : : : - L"memory"); /* { dg-error "wide string literal in 'asm'" } */ + L"memory"); /* { dg-error "8:wide string literal in 'asm'" } */ asm ("foo" : : : "memory", - L"memory"); /* { dg-error "wide string literal in 'asm'" } */ + L"memory"); /* { dg-error "8:wide string literal in 'asm'" } */ } /* Extra errors from the substitution of "" for wide strings: */ diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-7.c b/gcc/testsuite/gcc.dg/builtin-object-size-7.c new file mode 100644 index 00000000000..41742b974ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-object-size-7.c @@ -0,0 +1,71 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +typedef __SIZE_TYPE__ size_t; +extern void *malloc (size_t); +extern void abort (void); + +struct A +{ + int i, j, k; + char buf[255]; + int l, m, n, o; +}; + +int +main (void) +{ + const size_t s = sizeof (struct A); + const size_t o = __builtin_offsetof (struct A, buf); + struct A *a = malloc (s); + struct A *b = malloc (o + 212); + if (__builtin_object_size (a->buf, 0) != s - o) + abort (); + if (__builtin_object_size (a->buf, 1) != sizeof (a->buf)) + abort (); + if (__builtin_object_size (a->buf, 2) != s - o) + abort (); + if (__builtin_object_size (a->buf, 3) != sizeof (a->buf)) + abort (); + if (__builtin_object_size (&a->buf[0], 0) != s - o) + abort (); + if (__builtin_object_size (&a->buf[0], 1) != sizeof (a->buf)) + abort (); + if (__builtin_object_size (&a->buf[0], 2) != s - o) + abort (); + if (__builtin_object_size (&a->buf[0], 3) != sizeof (a->buf)) + abort (); + if (__builtin_object_size (&a->buf[6], 0) != s - o - 6) + abort (); + if (__builtin_object_size (&a->buf[6], 1) != sizeof (a->buf) - 6) + abort (); + if (__builtin_object_size (&a->buf[6], 2) != s - o - 6) + abort (); + if (__builtin_object_size (&a->buf[6], 3) != sizeof (a->buf) - 6) + abort (); + if (__builtin_object_size (b->buf, 0) != 212) + abort (); + if (__builtin_object_size (b->buf, 1) != 212) + abort (); + if (__builtin_object_size (b->buf, 2) != 212) + abort (); + if (__builtin_object_size (b->buf, 3) != 212) + abort (); + if (__builtin_object_size (&b->buf[0], 0) != 212) + abort (); + if (__builtin_object_size (&b->buf[0], 1) != 212) + abort (); + if (__builtin_object_size (&b->buf[0], 2) != 212) + abort (); + if (__builtin_object_size (&b->buf[0], 3) != 212) + abort (); + if (__builtin_object_size (&b->buf[28], 0) != 212 - 28) + abort (); + if (__builtin_object_size (&b->buf[28], 1) != 212 - 28) + abort (); + if (__builtin_object_size (&b->buf[28], 2) != 212 - 28) + abort (); + if (__builtin_object_size (&b->buf[28], 3) != 212 - 28) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/builtins-30.c b/gcc/testsuite/gcc.dg/builtins-30.c index 65a78fefe1d..37e5dba2db6 100644 --- a/gcc/testsuite/gcc.dg/builtins-30.c +++ b/gcc/testsuite/gcc.dg/builtins-30.c @@ -1,29 +1,27 @@ /* { dg-do compile } */ -/* { dg-options "-Wall -Wshadow" } */ +/* { dg-options "-Wall -Wshadow -fshow-column" } */ extern double strtod (const char *, char **); #define UNUSED __attribute__ ((unused)) /* A built-in function may be overridden by an old-style definition specifying too few arguments... */ -double cos () /* { dg-warning "shadows a built-in" } */ +double cos () /* { dg-warning "shadows a built-in|number of arguments" } */ { - /* { dg-warning "number of arguments doesn't match built-in prototype" "built-in" { target *-*-* } 10 } */ return strtod ("nan", 0); } /* the right number, but the wrong type, arguments... */ -double sin (foo) /* { dg-warning "shadows a built-in" } */ - int foo UNUSED; -{ /* { dg-warning "argument 'foo' doesn't match built-in prototype" } */ +double sin (foo) /* { dg-warning "8:shadows a built-in" } */ + int foo UNUSED; /* { dg-warning "10:argument 'foo' doesn't match built-in prototype" } */ +{ return strtod ("nan", 0); } /* or too many arguments. */ -long double cosl (foo, bar) /* { dg-warning "shadows a built-in" } */ - const char *foo UNUSED; +long double cosl (foo, bar) /* { dg-warning "shadows a built-in|number of arguments" } */ + const char *foo UNUSED; /* { dg-warning "18:argument 'foo' doesn't match" } */ int bar UNUSED; -{ /* { dg-warning "number of arguments doesn't match built-in prototype" } */ - /* { dg-warning "argument 'foo' doesn't match built-in prototype" "foo" { target *-*-* } 26 } */ +{ return strtod ("nan", 0); } diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-5.c b/gcc/testsuite/gcc.dg/c90-const-expr-5.c index 0a5af8124cd..9f5cdef8399 100644 --- a/gcc/testsuite/gcc.dg/c90-const-expr-5.c +++ b/gcc/testsuite/gcc.dg/c90-const-expr-5.c @@ -2,7 +2,7 @@ qualified void. */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic-errors -fshow-column" } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ typedef void V; int *p; @@ -15,14 +15,14 @@ f (void) { /* (V *)0 is a null pointer constant, so the assignment should be diagnosed. */ - q = (j ? p : (V *)0); /* { dg-error "3:assignment from incompatible pointer type" } */ - q = (j ? p : (void *)0); /* { dg-error "3:assignment from incompatible pointer type" } */ + q = (j ? p : (V *)0); /* { dg-error "5:assignment from incompatible pointer type" } */ + q = (j ? p : (void *)0); /* { dg-error "5:assignment from incompatible pointer type" } */ /* And this conversion should be valid. */ (void (*)(void))(V *)0; (void (*)(void))(void *)0; /* Pointers to qualified void are not valid null pointer constants. */ - fp = (const void *)0; /* { dg-error "3:ISO C forbids assignment between function pointer and 'void \\*'" } */ + fp = (const void *)0; /* { dg-error "6:ISO C forbids assignment between function pointer and 'void \\*'" } */ fp = (void *)0; fp = (V *)0; fp = 0; diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-8.c b/gcc/testsuite/gcc.dg/c90-const-expr-8.c index 966044c4eff..b00bb9718f8 100644 --- a/gcc/testsuite/gcc.dg/c90-const-expr-8.c +++ b/gcc/testsuite/gcc.dg/c90-const-expr-8.c @@ -9,19 +9,19 @@ #include <limits.h> enum e { - E0 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 12 } */ - E1 = 0 * (INT_MIN / -1), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 14 } */ - E2 = 0 * (INT_MAX * INT_MAX), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 16 } */ - E3 = 0 * (INT_MIN - 1), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 18 } */ - E4 = 0 * (unsigned)(INT_MIN - 1), /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 20 } */ - E5 = 0 * -INT_MIN, /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 22 } */ - E6 = 0 * !-INT_MIN, /* { dg-warning "integer overflow in expression" } */ - /* { dg-error "not an integer constant" "constant" { target *-*-* } 24 } */ + E0 = 0 * (INT_MAX + 1), /* { dg-warning "21:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 12 } */ + E1 = 0 * (INT_MIN / -1), /* { dg-warning "21:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 14 } */ + E2 = 0 * (INT_MAX * INT_MAX), /* { dg-warning "21:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 16 } */ + E3 = 0 * (INT_MIN - 1), /* { dg-warning "21:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 18 } */ + E4 = 0 * (unsigned)(INT_MIN - 1), /* { dg-warning "31:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 20 } */ + E5 = 0 * -INT_MIN, /* { dg-warning "12:integer overflow in expression" } */ + /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 22 } */ + E6 = 0 * !-INT_MIN, /* { dg-warning "13:integer overflow in expression" } */ + /* { dg-error "3:not an integer constant" "constant" { target *-*-* } 24 } */ E7 = INT_MIN % -1 /* Not an overflow. */ }; diff --git a/gcc/testsuite/gcc.dg/c99-tag-3.c b/gcc/testsuite/gcc.dg/c99-tag-3.c index 7406e7d64c7..a492037b07a 100644 --- a/gcc/testsuite/gcc.dg/c99-tag-3.c +++ b/gcc/testsuite/gcc.dg/c99-tag-3.c @@ -13,10 +13,10 @@ void f (void) { struct s0; } /* A declaration with a qualifier or storage class specifier declares the tag if no other declaration of it is visible. */ -const union u0; /* { dg-warning "useless type qualifier in empty declaration" } */ +const union u0; /* { dg-warning "13:useless type qualifier in empty declaration" } */ union u0 { long b; }; -extern struct s1; /* { dg-warning "useless storage class specifier in empty declaration" } */ +extern struct s1; /* { dg-warning "15:useless storage class specifier in empty declaration" } */ /* But if a declaration of the tag is visible, whether at the same scope or an outer scope, the declaration specifies the same type as @@ -25,13 +25,13 @@ extern struct s1; /* { dg-warning "useless storage class specifier in empty decl the members of an enumeration, it is a constraint violation. */ struct s2 { char x; }; -const struct s2; /* { dg-error "empty declaration with type qualifier does not redeclare tag" } */ +const struct s2; /* { dg-error "14:empty declaration with type qualifier does not redeclare tag" } */ union u1; -extern union u1; /* { dg-error "empty declaration with storage class specifier does not redeclare tag" } */ +extern union u1; /* { dg-error "14:empty declaration with storage class specifier does not redeclare tag" } */ union u2 { long b; }; -void g(void) { const union u2; } /* { dg-error "empty declaration with type qualifier does not redeclare tag" } */ +void g(void) { const union u2; } /* { dg-error "28:empty declaration with type qualifier does not redeclare tag" } */ /* And it does not redeclare the tag either if the outer tag is the wrong kind of tag. This also yields an error for the reference to @@ -39,21 +39,21 @@ void g(void) { const union u2; } /* { dg-error "empty declaration with type qual declaration. */ union u3 { float v; }; -void h(void) { const struct u3; } /* { dg-error "'u3' defined as wrong kind of tag" } */ -/* { dg-error "empty declaration with type qualifier does not redeclare tag" "wrong tag empty" { target *-*-* } 42 } */ +void h(void) { const struct u3; } /* { dg-error "29:'u3' defined as wrong kind of tag" } */ +/* { dg-error "29:empty declaration with type qualifier does not redeclare tag" "wrong tag empty" { target *-*-* } 42 } */ /* However, such useless specifiers are OK if the contents of the tag are being defined, or shadowed in an inner scope with the contents included in the shadowing. */ struct s3; -const struct s3 { int a; }; /* { dg-warning "useless type qualifier in empty declaration" } */ +const struct s3 { int a; }; /* { dg-warning "14:useless type qualifier in empty declaration" } */ union u4; -extern union u4 { int z; }; /* { dg-warning "useless storage class specifier in empty declaration" } */ +extern union u4 { int z; }; /* { dg-warning "14:useless storage class specifier in empty declaration" } */ enum e0 { E0 }; -void i(void) { const enum e0 { E1 }; } /* { dg-warning "useless type qualifier in empty declaration" } */ +void i(void) { const enum e0 { E1 }; } /* { dg-warning "32:useless type qualifier in empty declaration" } */ union u5 { int p; }; -void j(void) { extern struct u5 { int q; }; } /* { dg-warning "useless storage class specifier in empty declaration" } */ +void j(void) { extern struct u5 { int q; }; } /* { dg-warning "30:useless storage class specifier in empty declaration" } */ diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-1.c b/gcc/testsuite/gcc.dg/c99-vla-jump-1.c index 4e984d2b81b..8e34b100131 100644 --- a/gcc/testsuite/gcc.dg/c99-vla-jump-1.c +++ b/gcc/testsuite/gcc.dg/c99-vla-jump-1.c @@ -15,11 +15,11 @@ /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ void fa0 (int n) { goto a; a:{ int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } -void fa1 (int n) { goto a; { int b[n]; a:{ int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ -void fa2 (int n) { goto a; { int b[n]; { int c[n]; a:0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ -void fa3 (int n) { goto a; { int b[n]; { int c[n]; 0;} a:{ int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ -void fa4 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; a:0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ -void fa5 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} a:; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ +void fa1 (int n) { goto a; { int b[n]; a:{ int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */ +void fa2 (int n) { goto a; { int b[n]; { int c[n]; a:0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */ +void fa3 (int n) { goto a; { int b[n]; { int c[n]; 0;} a:{ int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */ +void fa4 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; a:0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */ +void fa5 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} a:; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */ void fa6 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; a:0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ void fa7 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; a:{ int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } void fa8 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; a:{ int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */ @@ -303,3 +303,7 @@ void fa285 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;} void fa286 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; a:; int j[n]; 0; goto a; } void fa287 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; a:0; goto a; } void fa288 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0;a: goto a; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-2.c b/gcc/testsuite/gcc.dg/c99-vla-jump-2.c index 27cecaa604f..2b4d4d56a5d 100644 --- a/gcc/testsuite/gcc.dg/c99-vla-jump-2.c +++ b/gcc/testsuite/gcc.dg/c99-vla-jump-2.c @@ -303,3 +303,7 @@ void fb285 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:g void fb286 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; a:; int j[n]; P03A:goto P03A;0;p03B:goto p03B; goto a; P03B:goto P03B; } void fb287 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; P0C:goto P0C;; int j[n]; a:0;p03B:goto p03B; goto a; P03B:goto P03B; } void fb288 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; P0C:goto P0C;; int j[n]; P03A:goto P03A;0;a: goto a; P03B:goto P03B; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-3.c b/gcc/testsuite/gcc.dg/c99-vla-jump-3.c index 0aff362d61f..ac1ae96c2c9 100644 --- a/gcc/testsuite/gcc.dg/c99-vla-jump-3.c +++ b/gcc/testsuite/gcc.dg/c99-vla-jump-3.c @@ -303,3 +303,7 @@ void fc285 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef void fc286 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; a:; typedef int (*j)[n]; 0; goto a; } void fc287 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; ; typedef int (*j)[n]; a:0; goto a; } void fc288 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; ; typedef int (*j)[n]; 0;a: goto a; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-4.c b/gcc/testsuite/gcc.dg/c99-vla-jump-4.c index e77a14209af..848dfba945c 100644 --- a/gcc/testsuite/gcc.dg/c99-vla-jump-4.c +++ b/gcc/testsuite/gcc.dg/c99-vla-jump-4.c @@ -303,3 +303,7 @@ void fd285 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typede void fd286 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; a:; typedef int (*j)[n]; P03A:goto P03A;0;p03B:goto p03B; goto a; P03B:goto P03B; } void fd287 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; P0C:goto P0C;; typedef int (*j)[n]; a:0;p03B:goto p03B; goto a; P03B:goto P03B; } void fd288 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; P0C:goto P0C;; typedef int (*j)[n]; P03A:goto P03A;0;a: goto a; P03B:goto P03B; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-5.c b/gcc/testsuite/gcc.dg/c99-vla-jump-5.c index ca3f85f5931..683bcf21eb3 100644 --- a/gcc/testsuite/gcc.dg/c99-vla-jump-5.c +++ b/gcc/testsuite/gcc.dg/c99-vla-jump-5.c @@ -16,8 +16,8 @@ f (int a, int b) { switch (a) { int v[b]; - case 2: /* { dg-error "case label in scope of identifier with variably modified type not containing enclosing switch statement" } */ - default: /* { dg-error "'default' label in scope of identifier with variably modified type not containing enclosing switch statement" } */ + case 2: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */ + default: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */ switch (a) { case 4: @@ -28,3 +28,7 @@ f (int a, int b) } } } + +/* Match extra informative notes. */ +/* { dg-message "note: switch starts here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cast-function-1.c b/gcc/testsuite/gcc.dg/cast-function-1.c index 8ed7d5da41c..781d0e22191 100644 --- a/gcc/testsuite/gcc.dg/cast-function-1.c +++ b/gcc/testsuite/gcc.dg/cast-function-1.c @@ -22,14 +22,14 @@ void bar(void) int i; str_t s; - d = ((double (*) (int)) foo1) (i); /* { dg-warning "non-compatible|abort" } */ - i = ((int (*) (double)) foo1) (d); /* { dg-warning "non-compatible|abort" } */ - s = ((str_t (*) (int)) foo1) (i); /* { dg-warning "non-compatible|abort" } */ + d = ((double (*) (int)) foo1) (i); /* { dg-warning "33:non-compatible|abort" } */ + i = ((int (*) (double)) foo1) (d); /* { dg-warning "33:non-compatible|abort" } */ + s = ((str_t (*) (int)) foo1) (i); /* { dg-warning "32:non-compatible|abort" } */ ((void (*) (int)) foo1) (d); /* { dg-warning "non-compatible|abort" } */ i = ((int (*) (int)) foo1) (i); /* { dg-bogus "non-compatible|abort" } */ (void) foo1 (i); /* { dg-bogus "non-compatible|abort" } */ - d = ((double (*) (int)) foo2) (i); /* { dg-warning "non-compatible|abort" } */ + d = ((double (*) (int)) foo2) (i); /* { dg-warning "33:non-compatible|abort" } */ i = ((int (*) (double)) foo2) (d); /* { dg-bogus "non-compatible|abort" } */ s = ((str_t (*) (int)) foo2) (i); /* { dg-warning "non-compatible|abort" } */ ((void (*) (int)) foo2) (d); /* { dg-warning "non-compatible|abort" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/line3.c b/gcc/testsuite/gcc.dg/cpp/line3.c index dc5bf818da9..7a1061478d4 100644 --- a/gcc/testsuite/gcc.dg/cpp/line3.c +++ b/gcc/testsuite/gcc.dg/cpp/line3.c @@ -14,15 +14,15 @@ main(void) char *A; A = "text"; /* { dg-warning "discards qualifiers" "case zero" } */ - A = one("text" + A = one("text" /* { dg-warning "discards qualifiers" "case one" } */ "text") - ; /* { dg-warning "discards qualifiers" "case one" } */ - A = two("text" + ; + A = two("text" /* { dg-warning "discards qualifiers" "case two" } */ "text") - ; /* { dg-warning "discards qualifiers" "case two" } */ - A = four("text" + ; + A = four("text" /* { dg-warning "discards qualifiers" "case four" } */ "text") - ; /* { dg-warning "discards qualifiers" "case four" } */ + ; return 0; } diff --git a/gcc/testsuite/gcc.dg/dremf-type-compat-2.c b/gcc/testsuite/gcc.dg/dremf-type-compat-2.c index 61f0ba84fe3..980ead187e7 100644 --- a/gcc/testsuite/gcc.dg/dremf-type-compat-2.c +++ b/gcc/testsuite/gcc.dg/dremf-type-compat-2.c @@ -11,8 +11,8 @@ float dremf (float, float); /* { dg-warning "prototype declaration" } */ float dremf (x, y) - float x; - float y; -{ /* { dg-warning "promoted argument '.' doesn't match prototype" } */ + float x; /* { dg-warning "promoted argument 'x' doesn't match prototype" } */ + float y; /* { dg-warning "promoted argument 'y' doesn't match prototype" } */ +{ return x + y; } diff --git a/gcc/testsuite/gcc.dg/dremf-type-compat-3.c b/gcc/testsuite/gcc.dg/dremf-type-compat-3.c index 437e26f65ba..3934a64e19f 100644 --- a/gcc/testsuite/gcc.dg/dremf-type-compat-3.c +++ b/gcc/testsuite/gcc.dg/dremf-type-compat-3.c @@ -11,8 +11,8 @@ float dremf (float, float); /* { dg-error "prototype declaration" } */ float dremf (x, y) - float x; - float y; -{ /* { dg-error "promoted argument '.' doesn't match prototype" } */ + float x; /* { dg-error "promoted argument 'x' doesn't match prototype" } */ + float y; /* { dg-error "promoted argument 'y' doesn't match prototype" } */ +{ return x + y; } diff --git a/gcc/testsuite/gcc.dg/enum-compat-1.c b/gcc/testsuite/gcc.dg/enum-compat-1.c index 18d1f7fe715..5fb150cee79 100644 --- a/gcc/testsuite/gcc.dg/enum-compat-1.c +++ b/gcc/testsuite/gcc.dg/enum-compat-1.c @@ -12,8 +12,8 @@ enum e2 {c, d}; void f(enum e1); /* { dg-error "prototype" "error at decl" } */ void f(x) - enum e2 x; -{ /* { dg-error "doesn't match prototype" "error at defn" } */ + enum e2 x; /* { dg-error "doesn't match prototype" } */ +{ return; } diff --git a/gcc/testsuite/gcc.dg/func-ptr-conv-1.c b/gcc/testsuite/gcc.dg/func-ptr-conv-1.c index 4e42e5fe117..c331fbc88fc 100644 --- a/gcc/testsuite/gcc.dg/func-ptr-conv-1.c +++ b/gcc/testsuite/gcc.dg/func-ptr-conv-1.c @@ -9,15 +9,15 @@ void f(void); -void *v1 = f; /* { dg-warning "pointer" "bad conversion" } */ -void *v2 = &f; /* { dg-warning "pointer" "bad conversion" } */ -void *v3 = (void *)f; /* { dg-warning "pointer" "bad conversion" } */ -void *v4 = (void *)&f; /* { dg-warning "pointer" "bad conversion" } */ +void *v1 = f; /* { dg-warning "12:pointer" "bad conversion" } */ +void *v2 = &f; /* { dg-warning "12:pointer" "bad conversion" } */ +void *v3 = (void *)f; /* { dg-warning "12:pointer" "bad conversion" } */ +void *v4 = (void *)&f; /* { dg-warning "12:pointer" "bad conversion" } */ void *v5; -char *c1 = f; /* { dg-warning "pointer" "bad conversion" } */ -char *c2 = &f; /* { dg-warning "pointer" "bad conversion" } */ -char *c3 = (char *)f; /* { dg-warning "pointer" "bad conversion" } */ -char *c4 = (char *)&f; /* { dg-warning "pointer" "bad conversion" } */ +char *c1 = f; /* { dg-warning "12:pointer" "bad conversion" } */ +char *c2 = &f; /* { dg-warning "12:pointer" "bad conversion" } */ +char *c3 = (char *)f; /* { dg-warning "12:pointer" "bad conversion" } */ +char *c4 = (char *)&f; /* { dg-warning "12:pointer" "bad conversion" } */ char *c5; void (*fp)(void); int a; @@ -25,20 +25,20 @@ int a; void g(void) { - v5 = f; /* { dg-warning "pointer" "bad conversion" } */ - v5 = &f; /* { dg-warning "pointer" "bad conversion" } */ - v5 = (void *)f; /* { dg-warning "pointer" "bad conversion" } */ - v5 = (void *)&f; /* { dg-warning "pointer" "bad conversion" } */ - c5 = f; /* { dg-warning "pointer" "bad conversion" } */ - c5 = &f; /* { dg-warning "pointer" "bad conversion" } */ - c5 = (char *)f; /* { dg-warning "pointer" "bad conversion" } */ - c5 = (char *)&f; /* { dg-warning "pointer" "bad conversion" } */ - fp = v5; /* { dg-warning "pointer" "bad conversion" } */ - fp = c5; /* { dg-warning "pointer" "bad conversion" } */ - fp = (void (*)(void))v5; /* { dg-warning "pointer" "bad conversion" } */ - fp = (void (*)(void))c5; /* { dg-warning "pointer" "bad conversion" } */ - (a ? f : v3); /* { dg-warning "pointer" "bad conversion" } */ - (a ? v2 : fp); /* { dg-warning "pointer" "bad conversion" } */ + v5 = f; /* { dg-warning "6:pointer" "bad conversion" } */ + v5 = &f; /* { dg-warning "6:pointer" "bad conversion" } */ + v5 = (void *)f; /* { dg-warning "8:pointer" "bad conversion" } */ + v5 = (void *)&f; /* { dg-warning "8:pointer" "bad conversion" } */ + c5 = f; /* { dg-warning "6:pointer" "bad conversion" } */ + c5 = &f; /* { dg-warning "6:pointer" "bad conversion" } */ + c5 = (char *)f; /* { dg-warning "8:pointer" "bad conversion" } */ + c5 = (char *)&f; /* { dg-warning "8:pointer" "bad conversion" } */ + fp = v5; /* { dg-warning "6:pointer" "bad conversion" } */ + fp = c5; /* { dg-warning "6:pointer" "bad conversion" } */ + fp = (void (*)(void))v5; /* { dg-warning "8:pointer" "bad conversion" } */ + fp = (void (*)(void))c5; /* { dg-warning "8:pointer" "bad conversion" } */ + (a ? f : v3); /* { dg-warning "6:pointer" "bad conversion" } */ + (a ? v2 : fp); /* { dg-warning "6:pointer" "bad conversion" } */ /* The following are OK. */ fp = 0; fp = (void *)0; diff --git a/gcc/testsuite/gcc.dg/gomp/for-1.c b/gcc/testsuite/gcc.dg/gomp/for-1.c index 840f9478499..384293e8275 100644 --- a/gcc/testsuite/gcc.dg/gomp/for-1.c +++ b/gcc/testsuite/gcc.dg/gomp/for-1.c @@ -44,6 +44,6 @@ void foo (int j, int k) baz (i); #pragma omp for - for (i = 0; i < 10; i-=3, j+=2) /* { dg-error "23:invalid increment expression" } */ + for (i = 0; i < 10; i-=3, j+=2) /* { dg-error "27:invalid increment expression" } */ baz (i); } diff --git a/gcc/testsuite/gcc.dg/gomp/pr27415.c b/gcc/testsuite/gcc.dg/gomp/pr27415.c index 418eaf678e9..010a6c3e4dd 100644 --- a/gcc/testsuite/gcc.dg/gomp/pr27415.c +++ b/gcc/testsuite/gcc.dg/gomp/pr27415.c @@ -15,8 +15,8 @@ void test2 (void) { int i = 0; -#pragma omp parallel for firstprivate (i) - for (i = 0; i < 10; i++) /* { dg-error "should not be firstprivate" } */ +#pragma omp parallel for firstprivate (i) /* { dg-error "should not be firstprivate" } */ + for (i = 0; i < 10; i++) ; } @@ -34,8 +34,8 @@ void test4 (void) { int i = 0; -#pragma omp parallel for reduction (*:i) - for (i = 0; i < 10; i++) /* { dg-error "should not be reduction" } */ +#pragma omp parallel for reduction (*:i) /* { dg-error "should not be reduction" } */ + for (i = 0; i < 10; i++) ; } diff --git a/gcc/testsuite/gcc.dg/label-decl-2.c b/gcc/testsuite/gcc.dg/label-decl-2.c index 97c453b78b7..6706a706bfe 100644 --- a/gcc/testsuite/gcc.dg/label-decl-2.c +++ b/gcc/testsuite/gcc.dg/label-decl-2.c @@ -8,9 +8,8 @@ typedef int b; void f (void) { - __label__ a, b, c, d; + __label__ a, b, c, d; /* { dg-warning "ISO C forbids label declarations" "label decls" { target *-*-* } 11 } */ __extension__ (void)&&d; /* { dg-error "label 'd' used but not defined" } */ - /* { dg-warning "ISO C forbids label declarations" "label decls" { target *-*-* } 11 } */ goto c; /* { dg-error "label 'c' used but not defined" } */ a: (void)0; b: (void)0; diff --git a/gcc/testsuite/gcc.dg/nofixed-point-2.c b/gcc/testsuite/gcc.dg/nofixed-point-2.c index 97bbf70225c..5820ded922e 100644 --- a/gcc/testsuite/gcc.dg/nofixed-point-2.c +++ b/gcc/testsuite/gcc.dg/nofixed-point-2.c @@ -9,7 +9,7 @@ f1 (void) } __typeof (0r) /* { dg-error "not supported" "reject fixed-point" } */ -b2 (void) +b2 (void) /* { dg-warning "defaults to" } */ { return 0r; /* { dg-error "not supported" "reject fixed-point" } */ } @@ -26,5 +26,4 @@ f4 (void) /* { dg-error "not supported" "reject fixed-point" } */ return 0k; /* { dg-error "not supported" "reject fixed-point" } */ } -/* { dg-warning "defaults to" "" { target *-*-* } 13 } */ /* { dg-error "is used without" "" { target *-*-* } 24 } */ diff --git a/gcc/testsuite/gcc.dg/old-style-prom-2.c b/gcc/testsuite/gcc.dg/old-style-prom-2.c index 0460facef61..e7e690e1417 100644 --- a/gcc/testsuite/gcc.dg/old-style-prom-2.c +++ b/gcc/testsuite/gcc.dg/old-style-prom-2.c @@ -7,8 +7,8 @@ float f (float, float); /* { dg-warning "prototype declaration" } */ float f (x, y) - float x; - float y; -{ /* { dg-warning "promoted argument '.' doesn't match prototype" } */ + float x; /* { dg-warning "promoted argument 'x' doesn't match prototype" } */ + float y; /* { dg-warning "promoted argument 'y' doesn't match prototype" } */ +{ return x + y; } diff --git a/gcc/testsuite/gcc.dg/old-style-prom-3.c b/gcc/testsuite/gcc.dg/old-style-prom-3.c index 931a4a7264b..720367f2e33 100644 --- a/gcc/testsuite/gcc.dg/old-style-prom-3.c +++ b/gcc/testsuite/gcc.dg/old-style-prom-3.c @@ -7,8 +7,8 @@ float f (float, float); /* { dg-error "prototype declaration" } */ float f (x, y) - float x; - float y; -{ /* { dg-error "promoted argument '.' doesn't match prototype" } */ + float x; /* { dg-error "promoted argument 'x' doesn't match prototype" } */ + float y; /* { dg-error "promoted argument 'y' doesn't match prototype" } */ +{ return x + y; } diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c new file mode 100644 index 00000000000..45fb2af2b30 --- /dev/null +++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile { target alpha*-*-* ia64*-*-* x86_64-*-* s390x-*-* } } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2 -fdump-tree-bswap" } */ + +#include <stdint.h> +#define __const_swab64(x) ((uint64_t)( \ + (((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56))) + + +/* This byte swap implementation is used by the Linux kernel and the + GNU C library. */ + +uint64_t +swap64 (uint64_t in) +{ + return __const_swab64 (in); +} + +/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 1 "bswap" } } */ +/* { dg-final { cleanup-tree-dump "bswap" } } */ diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c new file mode 100644 index 00000000000..fc77296d522 --- /dev/null +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-1.c @@ -0,0 +1,35 @@ +/* { dg-do compile { target alpha*-*-* i?86-*-* powerpc*-*-* rs6000-*-* x86_64-*-* s390*-*-* } } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-options "-O2 -fdump-tree-bswap" } */ + +#include <stdint.h> + +#define __const_swab32(x) ((uint32_t)( \ + (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24))) + +/* This byte swap implementation is used by the Linux kernel and the + GNU C library. */ + +uint32_t +swap32_a (uint32_t in) +{ + return __const_swab32 (in); +} + +/* The OpenSSH byte swap implementation. */ +uint32_t +swap32_b (uint32_t in) +{ + uint32_t a; + + a = (in << 16) | (in >> 16); + a = ((a & 0x00ff00ff) << 8) | ((a & 0xff00ff00) >> 8); + + return a; +} + +/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 2 "bswap" } } */ +/* { dg-final { cleanup-tree-dump "bswap" } } */ diff --git a/gcc/testsuite/gcc.dg/overflow-warn-1.c b/gcc/testsuite/gcc.dg/overflow-warn-1.c index 0cf08a3e77f..78909df368b 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-1.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-1.c @@ -12,23 +12,23 @@ enum e { /* Overflow in an unevaluated part of an expression is OK (example in the standard). */ E2 = 2 || 1 / 0, - E3 = 1 / 0, /* { dg-warning "division by zero" } */ - /* { dg-error "enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */ + E3 = 1 / 0, /* { dg-warning "10:division by zero" } */ + /* { dg-error "3:enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */ /* But as in DR#031, the 1/0 in an evaluated subexpression means the whole expression violates the constraints. */ - E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ + E4 = 0 * (1 / 0), /* { dg-warning "15:division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target *-*-* } 19 } */ - E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ + E5 = INT_MAX + 1, /* { dg-warning "16:integer overflow in expression" } */ /* Again, overflow in evaluated subexpression. */ - E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */ + E6 = 0 * (INT_MAX + 1), /* { dg-warning "21:integer overflow in expression" } */ /* A cast does not constitute overflow in conversion. */ E7 = (char) INT_MAX }; struct s { int a; - int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ - /* { dg-error "not an integer constant" "integer constant" { target *-*-* } 30 } */ + int : 0 * (1 / 0); /* { dg-warning "16:division by zero" } */ + /* { dg-error "not an integer constant" "22:integer constant" { target *-*-* } 30 } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ }; @@ -37,11 +37,11 @@ f (void) { /* This expression is not required to be a constant expression, so it should just involve undefined behavior at runtime. */ - int c = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ + int c = INT_MAX + 1; /* { dg-warning "19:integer overflow in expression" } */ } /* But this expression does need to be constant. */ -static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ +static int sc = INT_MAX + 1; /* { dg-warning "25:integer overflow in expression" } */ /* The first two of these involve overflow, so are not null pointer constants. The third has the overflow in an unevaluated diff --git a/gcc/testsuite/gcc.dg/pr15698-1.c b/gcc/testsuite/gcc.dg/pr15698-1.c index 6bb001aea7f..5a75a10733f 100644 --- a/gcc/testsuite/gcc.dg/pr15698-1.c +++ b/gcc/testsuite/gcc.dg/pr15698-1.c @@ -17,7 +17,7 @@ int foobar () } char *rindex(a, b) - register char *a, b; -{ /* { dg-warning "argument 'a' doesn't match built-in prototype" } */ + register char *a, b; /* { dg-warning "argument 'a' doesn't match built-in prototype" } */ +{ return 0; } diff --git a/gcc/testsuite/gcc.dg/pr20368-1.c b/gcc/testsuite/gcc.dg/pr20368-1.c index ac76c16f783..4140397c142 100644 --- a/gcc/testsuite/gcc.dg/pr20368-1.c +++ b/gcc/testsuite/gcc.dg/pr20368-1.c @@ -6,7 +6,7 @@ extern __typeof (f) g; /* { dg-error "'f' undeclared here \\(not in a function\\)" } */ int -f (x) - float x; /* { dg-warning "function declaration isn't a prototype" } */ +f (x) /* { dg-warning "function declaration isn't a prototype" } */ + float x; { } diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-1.c b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c index 57ab34eaab2..a9dd46623f3 100644 --- a/gcc/testsuite/gcc.dg/stmt-expr-label-1.c +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c @@ -402,3 +402,6 @@ void f194 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; goto a void fa194 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;p0D:goto p0D; goto a; P0D:goto P0D; } void f195 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0;a: goto a; } void fa195 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;a: goto a; P0D:goto P0D; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-2.c b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c index 35b96e830e5..be7aa521000 100644 --- a/gcc/testsuite/gcc.dg/stmt-expr-label-2.c +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c @@ -8,13 +8,13 @@ void f (int a) { - switch (a) + switch (a) /* { dg-message "here" } */ { case 0: case 1: ({ - case 2: /* { dg-error "case label in statement expression not containing enclosing switch statement" } */ - default: /* { dg-error "'default' label in statement expression not containing enclosing switch statement" } */ + case 2: /* { dg-error "switch jumps into statement expression" } */ + default: /* { dg-error "switch jumps into statement expression" } */ switch (a) { case 3: diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-3.c b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c index 7b1515f89ac..0a6722283f4 100644 --- a/gcc/testsuite/gcc.dg/stmt-expr-label-3.c +++ b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c @@ -6,3 +6,6 @@ /* { dg-options "-O2" } */ void f(void) { 1 ? 1 : ({ a : 1; 1; }); goto a; } /* { dg-error "jump into statement expression" } */ + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-6.c b/gcc/testsuite/gcc.dg/torture/builtin-math-6.c index 636381f5f2e..7fd1f729e2c 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-math-6.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-math-6.c @@ -11,57 +11,73 @@ /* All references to link_error should go away at compile-time. */ extern void link_error(int); -/* Return TRUE if the sign of X != sign of Y. This is important when - comparing signed zeros. */ +/* Return TRUE if the signs of floating point values X and Y are not + equal. This is important when comparing signed zeros. */ #define CKSGN_F(X,Y) \ - (__builtin_copysignf(1.0F,(X)) != __builtin_copysignf(1.0F,(Y))) + (__builtin_copysignf(1,(X)) != __builtin_copysignf(1,(Y))) #define CKSGN(X,Y) \ - (__builtin_copysign(1.0,(X)) != __builtin_copysign(1.0,(Y))) + (__builtin_copysign(1,(X)) != __builtin_copysign(1,(Y))) #define CKSGN_L(X,Y) \ - (__builtin_copysignl(1.0L,(X)) != __builtin_copysignl(1.0L,(Y))) + (__builtin_copysignl(1,(X)) != __builtin_copysignl(1,(Y))) + +/* Return TRUE if signs of the real parts, and the signs of the + imaginary parts, of X and Y are not equal. */ +#define COMPLEX_CKSGN_F(X,Y) \ + (CKSGN_F(__real__ (X), __real__ (Y)) || CKSGN_F (__imag__ (X), __imag__ (Y))) +#define COMPLEX_CKSGN(X,Y) \ + (CKSGN(__real__ (X), __real__ (Y)) || CKSGN (__imag__ (X), __imag__ (Y))) +#define COMPLEX_CKSGN_L(X,Y) \ + (CKSGN_L(__real__ (X), __real__ (Y)) || CKSGN_L (__imag__ (X), __imag__ (Y))) /* For complex numbers, test that FUNC(ARG) == (RES). */ #define TESTIT_COMPLEX(FUNC, ARG, RES) do { \ if (__builtin_##FUNC##f(ARG) != (RES) \ - || CKSGN_F(__real__ __builtin_##FUNC##f(ARG), __real__ (RES)) \ - || CKSGN_F(__imag__ __builtin_##FUNC##f(ARG), __imag__ (RES))) \ + || COMPLEX_CKSGN_F(__builtin_##FUNC##f(ARG), (RES))) \ link_error(__LINE__); \ if (__builtin_##FUNC(ARG) != (RES) \ - || CKSGN(__real__ __builtin_##FUNC(ARG), __real__ (RES)) \ - || CKSGN(__imag__ __builtin_##FUNC(ARG), __imag__ (RES))) \ + || COMPLEX_CKSGN(__builtin_##FUNC(ARG), (RES))) \ link_error(__LINE__); \ if (__builtin_##FUNC##l(ARG) != (RES) \ - || CKSGN_L(__real__ __builtin_##FUNC##l(ARG), __real__ (RES)) \ - || CKSGN_L(__imag__ __builtin_##FUNC##l(ARG), __imag__ (RES))) \ + || COMPLEX_CKSGN_L(__builtin_##FUNC##l(ARG), (RES))) \ link_error(__LINE__); \ } while (0) +/* Return TRUE if X differs from EXPECTED by more than 1%. If + EXPECTED is zero, then any difference may return TRUE. We don't + worry about signed zeros. */ +#define DIFF1PCT_F(X,EXPECTED) \ + (__builtin_fabsf((X)-(EXPECTED)) * 100 > __builtin_fabsf(EXPECTED)) +#define DIFF1PCT(X,EXPECTED) \ + (__builtin_fabs((X)-(EXPECTED)) * 100 > __builtin_fabs(EXPECTED)) +#define DIFF1PCT_L(X,EXPECTED) \ + (__builtin_fabsl((X)-(EXPECTED)) * 100 > __builtin_fabsl(EXPECTED)) + +/* Return TRUE if complex value X differs from EXPECTED by more than + 1% in either the real or imaginary parts. */ +#define COMPLEX_DIFF1PCT_F(X,EXPECTED) \ + (DIFF1PCT_F(__real__ (X), __real__ (EXPECTED)) \ + || DIFF1PCT_F(__imag__ (X), __imag__ (EXPECTED))) +#define COMPLEX_DIFF1PCT(X,EXPECTED) \ + (DIFF1PCT(__real__ (X), __real__ (EXPECTED)) \ + || DIFF1PCT(__imag__ (X), __imag__ (EXPECTED))) +#define COMPLEX_DIFF1PCT_L(X,EXPECTED) \ + (DIFF1PCT_L(__real__ (X), __real__ (EXPECTED)) \ + || DIFF1PCT_L(__imag__ (X), __imag__ (EXPECTED))) + /* Range test, for complex numbers check that FUNC(ARG) is within 1% of RES. This is NOT a test for accuracy to the last-bit, we're merely checking that we get relatively sane results. I.e. the GCC builtin is hooked up to the correct MPC function call. We first check the magnitude and then the sign. */ #define TESTIT_COMPLEX_R(FUNC, ARG, RES) do { \ - if (__builtin_fabsf(__real__ __builtin_##FUNC##f(ARG)) < __builtin_fabsf(__real__ (RES)) * 0.99F \ - || __builtin_fabsf(__real__ __builtin_##FUNC##f(ARG)) > __builtin_fabsf(__real__ (RES)) * 1.01F \ - || __builtin_fabsf(__imag__ __builtin_##FUNC##f(ARG)) < __builtin_fabsf(__imag__ (RES)) * 0.99F \ - || __builtin_fabsf(__imag__ __builtin_##FUNC##f(ARG)) > __builtin_fabsf(__imag__ (RES)) * 1.01F \ - || CKSGN_F(__real__ __builtin_##FUNC##f(ARG), __real__ (RES)) \ - || CKSGN_F(__imag__ __builtin_##FUNC##f(ARG), __imag__ (RES))) \ + if (COMPLEX_DIFF1PCT_F (__builtin_##FUNC##f(ARG), (RES)) \ + || COMPLEX_CKSGN_F(__builtin_##FUNC##f(ARG), (RES))) \ link_error(__LINE__); \ - if (__builtin_fabs(__real__ __builtin_##FUNC(ARG)) < __builtin_fabs(__real__ (RES)) * 0.99F \ - || __builtin_fabs(__real__ __builtin_##FUNC(ARG)) > __builtin_fabs(__real__ (RES)) * 1.01F \ - || __builtin_fabs(__imag__ __builtin_##FUNC(ARG)) < __builtin_fabs(__imag__ (RES)) * 0.99F \ - || __builtin_fabs(__imag__ __builtin_##FUNC(ARG)) > __builtin_fabs(__imag__ (RES)) * 1.01F \ - || CKSGN(__real__ __builtin_##FUNC(ARG), __real__ (RES)) \ - || CKSGN(__imag__ __builtin_##FUNC(ARG), __imag__ (RES))) \ + if (COMPLEX_DIFF1PCT (__builtin_##FUNC(ARG), (RES)) \ + || COMPLEX_CKSGN(__builtin_##FUNC(ARG), (RES))) \ link_error(__LINE__); \ - if (__builtin_fabsl(__real__ __builtin_##FUNC##l(ARG)) < __builtin_fabsl(__real__ (RES)) * 0.99F \ - || __builtin_fabsl(__real__ __builtin_##FUNC##l(ARG)) > __builtin_fabsl(__real__ (RES)) * 1.01F \ - || __builtin_fabsl(__imag__ __builtin_##FUNC##l(ARG)) < __builtin_fabsl(__imag__ (RES)) * 0.99F \ - || __builtin_fabsl(__imag__ __builtin_##FUNC##l(ARG)) > __builtin_fabsl(__imag__ (RES)) * 1.01F \ - || CKSGN_L(__real__ __builtin_##FUNC##l(ARG), __real__ (RES)) \ - || CKSGN_L(__imag__ __builtin_##FUNC##l(ARG), __imag__ (RES))) \ + if (COMPLEX_DIFF1PCT (__builtin_##FUNC(ARG), (RES)) \ + || COMPLEX_CKSGN(__builtin_##FUNC(ARG), (RES))) \ link_error(__LINE__); \ } while (0) @@ -129,8 +145,8 @@ int main (void) TESTIT_COMPLEX (clog, 1.0F, 0.0F); TESTIT_COMPLEX_R (clog, -1.0F, 3.141593FI); - TESTIT_COMPLEX (clog, __builtin_conjf(1.0F), 0.0F); - TESTIT_COMPLEX_R (clog, __builtin_conjf(-1.0F), 3.141593FI); + TESTIT_COMPLEX (clog, __builtin_conjf(1.0F), __builtin_conjf(0.0F)); /* Fails with mpc-0.6. */ + TESTIT_COMPLEX_R (clog, __builtin_conjf(-1.0F), __builtin_conjf(3.141593FI)); /* Fails with mpc-0.6. */ TESTIT_COMPLEX_R (clog, 3.45678F + 2.34567FI, 1.429713F + 0.596199FI); TESTIT_COMPLEX_R (clog, 3.45678F - 2.34567FI, 1.429713F - 0.596199FI); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/col-1.c b/gcc/testsuite/gcc.dg/tree-ssa/col-1.c new file mode 100644 index 00000000000..5838134ad21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/col-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple-details-lineno" } */ + +void foo (int, int); + +int +m(int x) +{ + int c, a; + a = (c = 5) + 16 + x * 2 ; + foo (c, a); +} + +/* { dg-final { scan-tree-dump-times "10:9.*c = 5" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "10:14.*c . 16" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "10:4.*a =" 1 "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c new file mode 100644 index 00000000000..f8c12c8d6c5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/fre-vce-1.c @@ -0,0 +1,35 @@ +/* { dg-options "-O2 -fdump-tree-fre -w" } */ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(sizeof(int)*4) )) +struct s { vector int i; }; +vector float f(struct s *sv) +{ + sv->i = (vector int){1, 2, 3, 4}; + return (vector float)sv->i; +} + + +vector float f1(struct s *sv, vector int a) +{ + sv->i = a; + return (vector float)sv->i; +} + +struct s1 { int i; }; + +void g(struct s1 *, float); +void a1 (struct s1 sv) +{ + sv.i = 1; + g(&sv, *(float*)&sv.i); +} + + +void a2 (struct s1 sv, int i) +{ + sv.i = i; + g(&sv, *(float*)&sv.i); +} + +/* { dg-final { scan-tree-dump-times "sv_\[0-9\]\\\(D\\\)->i" 2 "fre" } } */ +/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-5.c b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-5.c index 643ac8053e4..19914cabfd0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/prefetch-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/prefetch-5.c @@ -1,6 +1,6 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -fdump-tree-aprefetch-details" } */ +/* { dg-options "-O2 --param min-insn-to-prefetch-ratio=5 -fprefetch-loop-arrays -march=athlon -fdump-tree-aprefetch-details" } */ /* These are common idioms for writing variable-length arrays at the end of structures. We should not deduce anything about the number of iterations diff --git a/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-1.c b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-1.c new file mode 100644 index 00000000000..0cf2ca06d14 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-1.c @@ -0,0 +1,48 @@ +/* { dg-require-effective-target vect_float } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 16 + +float in[N] = {232,132,32,432,532,321,327,323,321,324,322,329,432,832,932,232}; +float out[N]; +float check_res[N] = {112,-4,-120,264,348,121,111,91,73,60,42,33,120,504,588,-128}; +float a[2*N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; + +/* Outer-loop vectorization. */ + +__attribute__ ((noinline)) void +foo () +{ + int i, j; + float res; + + for (i = 0; i < N; i++) + { + res = in[i]; + + for (j = 0; j < N; j++) + res = res - a[i+j]; + + out[i] = res; + } + + for (i = 0; i < N; i++) + if (out[i] != check_res[i]) + abort (); + +} + +int main () +{ + check_vect (); + + foo(); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-2.c b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-2.c new file mode 100644 index 00000000000..fd63a785d00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-2.c @@ -0,0 +1,48 @@ +/* { dg-require-effective-target vect_float } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +float out[N]; +float check_res[N] = {880,864,848,832,816,800,784,768,752,736,720,704,688,672,656,640}; +float a[2*N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; + +/* Outer-loop vectorization. */ + +__attribute__ ((noinline)) void +foo () +{ + int i, j; + float res; + + for (i = 0; i < N; i++) + { + res = 1000; + + for (j = 0; j < N; j++) + res = res - a[i+j]; + + out[i] = res; + } + + for (i = 0; i < N; i++) + if (out[i] != check_res[i]) + abort (); + +} + +int main () +{ + check_vect (); + + foo(); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-3.c b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-3.c new file mode 100644 index 00000000000..70fa6b84d98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-nest-cycle-3.c @@ -0,0 +1,57 @@ +/* { dg-require-effective-target vect_float } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 +#define DIFF 82 + +float c[N][N], b[N][N], a[N]; + +__attribute__ ((noinline)) int +main1 () +{ + int i, j; + float diff; + + /* In inner loop vectorization -funsafe-math-optimizations is needed to + vectorize the summation. But in outer loop vectorization the order of + calculation doesn't change, therefore, there is no need in that flag. */ + for (i = 0; i < N; i++) + { + diff = 2; + for (j = 0; j < N; j++) + diff += (b[j][i] - c[j][i]); + + a[i] = diff; + } + + /* Check results: */ + for (i = 0; i < N; i++) + if (a[i] != DIFF) + abort (); + + return 0; +} + +int main (void) +{ + int i, j; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + b[i][j] = i+j+5; + c[i][j] = i+j; + } + + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c index 3d237b78e72..f88dd21059b 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c @@ -4,9 +4,7 @@ signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); -/* Can't do outer-loop vectorization because of non-consecutive access. - Currently fails to vectorize because the reduction pattern is not - recognized. */ +/* Can't do outer-loop vectorization because of non-consecutive access. */ int foo (){ @@ -22,7 +20,5 @@ foo (){ } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */ -/* FORNOW */ -/* { dg-final { scan-tree-dump-times "strided access in outer loop" 1 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "unexpected pattern" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "strided access in outer loop" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c index 88d6b7abccd..c6cc4a8d1a4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4f.c @@ -66,5 +66,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: not allowed" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c index 88d6b7abccd..c6cc4a8d1a4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4g.c @@ -66,5 +66,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: not allowed" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c index 88d6b7abccd..c6cc4a8d1a4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4k.c @@ -66,5 +66,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: not allowed" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c index 88d6b7abccd..c6cc4a8d1a4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4l.c @@ -66,5 +66,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: not allowed" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vla-8.c b/gcc/testsuite/gcc.dg/vla-8.c index e4c6ae4157f..6e14a06875e 100644 --- a/gcc/testsuite/gcc.dg/vla-8.c +++ b/gcc/testsuite/gcc.dg/vla-8.c @@ -23,8 +23,12 @@ void foo1(int n) { } void foo2(int n) { - goto A; /* { dg-error "jump into scope of identifier with variably modified type" } */ + goto A; /* { dg-error "jump into scope of identifier with variably modified type" } */ int (*(*bar2)(void))[n]; A: ; } + +/* Match extra informative notes. */ +/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */ +/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gfortran.dg/bounds_check_strlen_8.f90 b/gcc/testsuite/gfortran.dg/bounds_check_strlen_8.f90 new file mode 100644 index 00000000000..c54f14144f8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bounds_check_strlen_8.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! +! PR fortran/40383 +! Gave before a bogus out of bounds. +! Contributed by Joost VandeVondele. +! +MODULE M1 + INTEGER, PARAMETER :: default_string_length=80 +END MODULE M1 +MODULE M2 + USE M1 + IMPLICIT NONE +CONTAINS + FUNCTION F1(a,b,c,d) RESULT(RES) + CHARACTER(LEN=default_string_length), OPTIONAL :: a,b,c,d + LOGICAL :: res + END FUNCTION F1 +END MODULE M2 + +MODULE M3 + USE M1 + USE M2 + IMPLICIT NONE +CONTAINS + SUBROUTINE S1 + CHARACTER(LEN=default_string_length) :: a,b + LOGICAL :: L1 + INTEGER :: i + DO I=1,10 + L1=F1(a,b) + ENDDO + END SUBROUTINE +END MODULE M3 + +USE M3 +CALL S1 +END + +! { dg-final { cleanup-modules "m1 m2 m3" } } diff --git a/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f b/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f index b7586ea6e18..bfd215d9736 100644 --- a/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f +++ b/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f @@ -1,6 +1,7 @@ C Test program for common block debugging. G. Helffrich 11 July 2004. C { dg-do compile } C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "*" } { "-gdwarf-2" } } +C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "-g1" } { "" } } C { dg-options "-dA" } common i,j common /label/l,m diff --git a/gcc/testsuite/gfortran.dg/debug/pr37738.f b/gcc/testsuite/gfortran.dg/debug/pr37738.f index b0a787b2e52..48e18841ac2 100644 --- a/gcc/testsuite/gfortran.dg/debug/pr37738.f +++ b/gcc/testsuite/gfortran.dg/debug/pr37738.f @@ -1,6 +1,7 @@ C PR debug/37738 C { dg-do compile } C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "*" } { "-gdwarf-2" } } +C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "-g1" } { "" } } C { dg-options "-dA" } subroutine a diff --git a/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90 b/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90 index 6d681436125..57d4bc38e9e 100644 --- a/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90 +++ b/gcc/testsuite/gfortran.dg/dummy_procedure_1.f90 @@ -21,6 +21,9 @@ contains end function f end interface end subroutine s1 + subroutine s2(x) + integer :: x + end subroutine end module m1 use m1 @@ -38,6 +41,7 @@ end module m1 call s1(x) ! explicit interface call s1(y) ! declared external call s1(z) ! { dg-error "Expected a procedure for argument" } + call s2(x) ! { dg-error "Invalid procedure argument" } contains integer function w() w = 1 diff --git a/gcc/testsuite/gfortran.dg/interface_20.f90 b/gcc/testsuite/gfortran.dg/interface_20.f90 index 2d7df47eb8e..829add2ff9b 100644 --- a/gcc/testsuite/gfortran.dg/interface_20.f90 +++ b/gcc/testsuite/gfortran.dg/interface_20.f90 @@ -16,5 +16,5 @@ end module m use m implicit none intrinsic cos -call sub(cos) ! { dg-error "Type/rank mismatch in argument" } +call sub(cos) ! { dg-error "wrong number of arguments" } end diff --git a/gcc/testsuite/gfortran.dg/interface_21.f90 b/gcc/testsuite/gfortran.dg/interface_21.f90 index fea6507b05d..e3db771a93d 100644 --- a/gcc/testsuite/gfortran.dg/interface_21.f90 +++ b/gcc/testsuite/gfortran.dg/interface_21.f90 @@ -18,5 +18,5 @@ end module m use m implicit none EXTERNAL foo ! implicit interface is undefined -call sub(foo) ! { dg-error "Type/rank mismatch in argument" } +call sub(foo) ! { dg-error "is not a function" } end diff --git a/gcc/testsuite/gfortran.dg/interface_26.f90 b/gcc/testsuite/gfortran.dg/interface_26.f90 index 0778345c3e5..c1af6c67d58 100644 --- a/gcc/testsuite/gfortran.dg/interface_26.f90 +++ b/gcc/testsuite/gfortran.dg/interface_26.f90 @@ -37,7 +37,7 @@ CONTAINS END INTERFACE INTEGER, EXTERNAL :: UserOp - res = UserFunction( a,b, UserOp ) ! { dg-error "Type/rank mismatch in argument" } + res = UserFunction( a,b, UserOp ) ! { dg-error "Type/kind mismatch in return value" } if( res .lt. 10 ) then res = recSum( a, res, UserFunction, UserOp ) diff --git a/gcc/testsuite/gfortran.dg/interface_27.f90 b/gcc/testsuite/gfortran.dg/interface_27.f90 index a3f1e4b2620..71975b6b7d2 100644 --- a/gcc/testsuite/gfortran.dg/interface_27.f90 +++ b/gcc/testsuite/gfortran.dg/interface_27.f90 @@ -31,8 +31,8 @@ subroutine caller end interface pointer :: p - call a(4.3,func) ! { dg-error "Type/rank mismatch in argument" } - p => func ! { dg-error "Interfaces don't match in procedure pointer assignment" } + call a(4.3,func) ! { dg-error "INTENT mismatch in argument" } + p => func ! { dg-error "INTENT mismatch in argument" } end subroutine end module diff --git a/gcc/testsuite/gfortran.dg/interface_28.f90 b/gcc/testsuite/gfortran.dg/interface_28.f90 index 53495a44348..42a8208f4b3 100644 --- a/gcc/testsuite/gfortran.dg/interface_28.f90 +++ b/gcc/testsuite/gfortran.dg/interface_28.f90 @@ -2,7 +2,8 @@ ! ! PR 36947: Attributes not fully checked comparing actual vs dummy procedure ! -! Contributed by Walter Spector <w6ws@earthlink.net> +! Original test case by Walter Spector <w6ws@earthlink.net> +! Modified by Janus Weil <janus@gcc.gnu.org> module testsub contains @@ -12,7 +13,6 @@ module testsub integer, intent(in), optional:: x end subroutine end interface - print *, "In test(), about to call sub()" call sub() end subroutine end module @@ -20,9 +20,12 @@ end module module sub contains subroutine subActual(x) - ! actual subroutine's argment is different in intent and optional - integer, intent(inout):: x - print *, "In subActual():", x + ! actual subroutine's argment is different in intent + integer, intent(inout),optional:: x + end subroutine + subroutine subActual2(x) + ! actual subroutine's argment is missing OPTIONAL + integer, intent(in):: x end subroutine end module @@ -32,7 +35,8 @@ program interfaceCheck integer :: a - call test(subActual) ! { dg-error "Type/rank mismatch in argument" } + call test(subActual) ! { dg-error "INTENT mismatch in argument" } + call test(subActual2) ! { dg-error "OPTIONAL mismatch in argument" } end program ! { dg-final { cleanup-modules "sub testsub" } } diff --git a/gcc/testsuite/gfortran.dg/interface_29.f90 b/gcc/testsuite/gfortran.dg/interface_29.f90 new file mode 100644 index 00000000000..e94571f43e1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_29.f90 @@ -0,0 +1,52 @@ +! { dg-do compile } +! +! PR 36947: Attributes not fully checked comparing actual vs dummy procedure +! +! Contributed by Tobias Burnus <burnus@net-b.de> + +module m +interface foo + module procedure one, two +end interface foo +contains +subroutine one(op,op2) + interface + subroutine op(x, y) + complex, intent(in) :: x(:) + complex, intent(out) :: y(:) + end subroutine op + subroutine op2(x, y) + complex, intent(in) :: x(:) + complex, intent(out) :: y(:) + end subroutine op2 + end interface +end subroutine one +subroutine two(ops,i,j) + interface + subroutine op(x, y) + complex, intent(in) :: x(:) + complex, intent(out) :: y(:) + end subroutine op + end interface + real :: i,j +end subroutine two +end module m + +module test +contains +subroutine bar() + use m + call foo(precond_prop,prop2) +end subroutine bar + subroutine precond_prop(x, y) + complex, intent(in) :: x(:) + complex, intent(out) :: y(:) + end subroutine + subroutine prop2(x, y) + complex, intent(in) :: x(:) + complex, intent(out) :: y(:) + end subroutine +end module test + +! { dg-final { cleanup-modules "m" } } + diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 index 25c018301f3..c7ec4f2f3fc 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 @@ -57,6 +57,8 @@ program prog procedure ( ) :: r procedure ( up ) :: s ! { dg-error "must be explicit" } + procedure(t) :: t ! { dg-error "may not be used as its own interface" } + call s contains diff --git a/gcc/testsuite/gfortran.dg/proc_decl_7.f90 b/gcc/testsuite/gfortran.dg/proc_decl_7.f90 index 79f413754c1..c8c2a81c5c6 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_7.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_7.f90 @@ -16,6 +16,6 @@ end module m use m implicit none intrinsic cos -call sub(cos) ! { dg-error "Type/rank mismatch in argument" } +call sub(cos) ! { dg-error "wrong number of arguments" } end ! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/proc_decl_8.f90 b/gcc/testsuite/gfortran.dg/proc_decl_8.f90 index 67c1ddb0ee6..2d3514ec896 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_8.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_8.f90 @@ -20,6 +20,6 @@ use m implicit none EXTERNAL foo ! interface is undefined procedure(cos) :: foo ! { dg-error "Duplicate EXTERNAL attribute specified" } -call sub(foo) ! { dg-error "Type/rank mismatch in argument" } +call sub(foo) ! { dg-error "is not a function" } end ! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 index 92d65423157..469ebd448b1 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 @@ -27,7 +27,7 @@ program bsp end function p3 end interface - pptr => add ! { dg-error "Interfaces don't match" } + pptr => add ! { dg-error "is not a subroutine" } q => add @@ -40,11 +40,11 @@ program bsp p2 => p1 p1 => p2 - p1 => abs ! { dg-error "Interfaces don't match" } - p2 => abs ! { dg-error "Interfaces don't match" } + p1 => abs ! { dg-error "Type/kind mismatch in return value" } + p2 => abs ! { dg-error "Type/kind mismatch in return value" } p3 => dsin - p3 => sin ! { dg-error "Interfaces don't match" } + p3 => sin ! { dg-error "Type/kind mismatch in return value" } contains diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_15.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_15.f90 index f95d2806217..57269b0ccf0 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_15.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_15.f90 @@ -19,10 +19,10 @@ p4 => p2 p6 => p1 ! invalid -p1 => iabs ! { dg-error "Interfaces don't match" } -p1 => p2 ! { dg-error "Interfaces don't match" } -p1 => p5 ! { dg-error "Interfaces don't match" } -p6 => iabs ! { dg-error "Interfaces don't match" } +p1 => iabs ! { dg-error "Type/kind mismatch in return value" } +p1 => p2 ! { dg-error "Type/kind mismatch in return value" } +p1 => p5 ! { dg-error "Type/kind mismatch in return value" } +p6 => iabs ! { dg-error "Type/kind mismatch in return value" } contains diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr40413.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr40413.f90 new file mode 100644 index 00000000000..d8fa73d6991 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr40413.f90 @@ -0,0 +1,46 @@ +module state_matrices + + implicit none + private + + public :: state_matrix_copy + public :: state_matrix_t + public :: matrix_element_t + + type :: matrix_element_t + private + integer, dimension(:), allocatable :: f + end type matrix_element_t + + type :: state_matrix_t + private + type(matrix_element_t), dimension(:), allocatable :: me + end type state_matrix_t + + type :: polarization_t + logical :: polarized = .false. + integer :: spin_type = 0 + integer :: multiplicity = 0 + type(state_matrix_t) :: state + end type polarization_t + +contains + + function polarization_copy (pol_in) result (pol) + type(polarization_t) :: pol + type(polarization_t), intent(in) :: pol_in + !!! type(state_matrix_t) :: state_dummy + pol%polarized = pol_in%polarized + pol%spin_type = pol_in%spin_type + pol%multiplicity = pol_in%multiplicity + !!! state_dummy = state_matrix_copy (pol_in%state) + !!! pol%state = state_dummy + pol%state = state_matrix_copy (pol_in%state) + end function polarization_copy + + function state_matrix_copy (state_in) result (state) + type(state_matrix_t) :: state + type(state_matrix_t), intent(in), target :: state_in + end function state_matrix_copy + +end module state_matrices diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f new file mode 100644 index 00000000000..de7664ce6b3 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f @@ -0,0 +1,18 @@ + SUBROUTINE VROT2(N,DIS) + IMPLICIT DOUBLE PRECISION (A-H,O-Z) + PARAMETER(ZERO=0.0D+00) + COMMON /SYMSPD/ PTR(3,144) + DIMENSION DIS(3,2),TMP(3,2) + DO I = 1,3 + TMP1 = ZERO + DO J = 1,3 + TMP1 = TMP1 + PTR(I,N+J) + END DO + TMP(I,1) = TMP1 + END DO + DO I = 1,3 + DIS(I,1) = TMP(I,1) + END DO + RETURN + END + diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index e906265e40c..98e2f667bdb 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008 +# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -289,10 +289,18 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { $comp_output] } { remove-build-file "trivial.S" foreach level {1 "" 3} { - lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"] - foreach opt $opt_opts { - lappend DEBUG_TORTURE_OPTIONS \ - [list "${type}${level}" "$opt" ] + if { ($type == "-gdwarf-2") && ($level != "") } { + lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"] + foreach opt $opt_opts { + lappend DEBUG_TORTURE_OPTIONS \ + [list "${type}" "-g${level}" "$opt" ] + } + } else { + lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"] + foreach opt $opt_opts { + lappend DEBUG_TORTURE_OPTIONS \ + [list "${type}${level}" "$opt" ] + } } } } @@ -320,7 +328,8 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } { if { ([string match {*/debug-[126].c} "$nshort"] \ || [string match {*/enum-1.c} "$nshort"] \ || [string match {*/enum-[12].C} "$nshort"]) \ - && [string match "*1" [lindex "$flags" 0] ] } { + && ([string match "*1" [lindex "$flags" 0] ] + || [lindex "$flags" 1] == "-g1") } { set doit 0 } diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp index 55d6d400c40..70a0888a0a4 100644 --- a/gcc/testsuite/lib/gfortran-dg.exp +++ b/gcc/testsuite/lib/gfortran-dg.exp @@ -135,10 +135,18 @@ proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } { } remove-build-file "trivial.S" foreach level {1 "" 3} { - lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"] - foreach opt $opt_opts { - lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}" \ - "$opt" ] + if { ($type == "-gdwarf-2") && ($level != "") } { + lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"] + foreach opt $opt_opts { + lappend DEBUG_TORTURE_OPTIONS \ + [list "${type}" "-g${level}" "$opt" ] + } + } else { + lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"] + foreach opt $opt_opts { + lappend DEBUG_TORTURE_OPTIONS \ + [list "${type}${level}" "$opt" ] + } } } } |