diff options
Diffstat (limited to 'gcc/testsuite')
125 files changed, 1340 insertions, 175 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb692358746..35f45eacce1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,254 @@ +2005-12-06 Roger Sayle <roger@eyesopen.com> + + * g++.dg/warn/Wstring-literal-comparison-1.C: New test case. + * g++.dg/warn/Wstring-literal-comparison-2.C: Likewise. + * g++.dg/warn/Wstring-literal-comparison-3.C: Likewise. + * g++.dg/warn/Wstring-literal-comparison-4.C: Likewise. + +2005-12-06 Roger Sayle <roger@eyesopen.com> + + PR c++/25263 + * g++.dg/other/array2.C: New test case. + +2005-12-05 Geoffrey Keating <geoffk@apple.com> + + * gcc.dg/darwin-weakimport-3.c: New. + + * g++.old-deja/g++.abi/vtable2.C: Make weakrefs static. + * gcc.dg/attr-weakref-1.c: Modify to not try to test public weakrefs, + and to work on Darwin. + * gcc.dg/attr-weakref-1b.c: New file. + * gcc.dg/attr-weakref-2.c: New test. + * gcc.dg/darwin-weakref-1.c: New test. + +2005-12-05 Janis Johnson <janis187@us.ibm.com> + + PR testsuite/25247 + * lib/target-supports-dg.exp (dg-skip-if): Fix target selector for + use in selector expressions. + (dg-xfail-if): Ditto. + * gcc.test-framework/dg-dot-run-sif-exp-P.c: New test. + * gcc.test-framework/dg-dot-run-sif-exp-U.c: New test. + * gcc.test-framework/dg-dot-run-xif-exp-P.c: New test. + * gcc.test-framework/dg-dot-run-xif-exp-XP.c: New test. + * gcc.test-framework/test-framework.exp: Skip generated tests if + CHECK_TEST_FRAMEWORK is not 1. + +2005-12-05 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR tree-optimization/24963 + * gcc.dg/vect/vect-62.c: Remove outdated dg-line. + + PR target/24108 + * gcc.dg/vect/vect-76.c: Do not XFAIL on vect_no_align platforms. + + PR target/18580 + * gcc.dg/vect/vect-reduc-1char.c: XFAIL on vect_no_int_max platforms. + * gcc.dg/vect/vect-reduc-2short.c: Likewise. + * gcc.dg/vect/vect-reduc-1short.c: Likewise. + * gcc.dg/vect/vect-reduc-2char.c: Likewise. + +2005-12-05 Jakub Jelinek <jakub@redhat.com> + + * gcc.target/i386/movq-2.c: Add -mtune=pentium4 to + dg-options. + +2005-12-04 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/c90-const-expr-5.c, gcc.dg/c99-const-expr-5.c: New tests. + +2005-12-04 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/format/cast-1.c: New test. + +2005-12-04 Roger Sayle <roger@eyesopen.com> + + PR c/7776 + * gcc.dg/Wstring-literal-comparison-1.c: New test case. + * gcc.dg/Wstring-literal-comparison-2.c: Likewise. + * gcc.dg/Wstring-literal-comparison-3.c: Likewise. + * gcc.dg/Wstring-literal-comparison-4.c: Likewise. + +2005-12-03 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/cast-pretty-print-1.c: New test. + +2005-12-03 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/c90-const-expr-4.c, gcc.dg/c99-const-expr-4.c: New tests. + +2005-12-02 Mark Mitchell <mark@codesourcery.com> + + PR c++/24173 + * g++.dg/template/friend40.C: New test. + +2005-12-02 Jakub Jelinek <jakub@redhat.com> + + PR target/25199 + * gcc.target/i386/movq-2.c: New test. + * gcc.target/i386/movq.c: Remove target i?86, instead add + dg-require-effective-target ilp32. + +2005-12-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/24103 + * g++.dg/other/default1.C: New test. + +2005-12-02 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/20031106-6.c: Remove XFAIL. + +2005-12-02 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * gcc.dg/lvalue-2.c (f0): Put "error: " marker back. + +2005-12-02 Alan Modra <amodra@bigpond.net.au> + + PR target/21017 + * gcc.target/powerpc/rotate.c: New. + +2005-12-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/pr24489.f90: Delete, replaced by read_eor.f90. + * gfortran.dg/pr24584.f90: Delete, replaced by namelist_empty.f90. + +2005-12-01 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR c/13384 + * gcc.dg/pr17730-1.c: Adjust. + * gcc.dg/lvalue1.c (main): Likewise. + * gcc.dg/lvalue-2.c: Likewise. + * g++.dg/pr7503-3.C + +2005-12-01 Geoffrey Keating <geoffk@apple.com> + + * gcc.target/powerpc/pr18096-1.c: Be more liberal about possible + error messages. + +2005-12-01 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/24789 + * gfortran.dg/auto_char_dummy_array_2.f90: New test. + +2005-12-01 Uros Bizjak <uros@kss-loka.si> + + PR target/24475 + * lib/target-supports.exp (check_effective_target_tls): New. + (check_effective_target_tls_runtime): New. + * gcc.dg/tls/tls.exp, g++.dg/tls/tls.exp: Remove check + for TLS support. + * gcc.dg/tls/opt-1.c, gcc.dg/tls/opt-2.c, gcc.dg/tls/opt-3.c, + gcc.dg/tls/opt-4.c, gcc.dg/tls/opt-5.c, gcc.dg/tls/opt-6.c, + gcc.dg/tls/opt-7.c, gcc.dg/tls/opt-8.c, gcc.dg/tls/opt-9.c, + gcc.dg/tls/opt-10.c, gcc.dg/tls/diag-1.c, gcc.dg/tls/diag-2.c, + gcc.dg/tls/diag-3.c, gcc.dg/tls/diag-4.c, gcc.dg/tls/diag-5.c, + gcc.dg/tls/alias-1.c, gcc.dg/tls/alpha-1.c, gcc.dg/tls/asm-1.c, + gcc.dg/tls/debug-1.c, gcc.dg/tls/init-1.c, gcc.dg/tls/nonpic-1.c, + gcc.dg/tls/pic-1.c, gcc.dg/tls/section-1.c, gcc.dg/tls/struct-1.c, + gcc.dg/tls/trivial.c, g++.dg/tls/diag-1.C, g++.dg/tls/diag-2.C, + g++.dg/tls/diag-3.C, g++.dg/tls/diag-4.C, g++.dg/tls/init-1.C, + g++.dg/tls/init-2.C, g++.dg/tls/trivial.C: Require + effective-target TLS. + * gcc.dg/tls/pr24428-2.c, gcc.dg/tls/pr24428.c, gcc.dg/tls/opt-11.c, + g++.dg/tls/static-1a.cc, g++.dg/tls/static-1.C: Require + effective-target TLS runtime. + +2005-12-01 Uros Bizjak <uros@kss-loka.si> + + * lib/gcov.exp (clean-gcov): Also remove $base.h.gcov files. + +2005-12-01 Hans-Peter Nilsson <hp@axis.com> + + * gcc.dg/20041106-1.c, gcc.dg/20030321-1.c, gcc.dg/pr17112-1.c, + gcc.dg/pr17112-1.c, g++.dg/other/packed1.C, + g++.dg/other/crash-4.C, g++.dg/ext/packed8.C: Match "attribute + ignored" warnings when "packing" is the same as the ABI layout. + +2005-11-30 Bernhard Fischer <rep.nop@aon.at> + + PR fortran/21302 + * gfortran.dg/line_length_1.f: New test. + * gfortran.dg/line_length_2.f90: Ditto. + +2005-11-30 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/21655 + * g++.dg/tree-ssa/pr14814.C: Remove XFAIL. + +2005-11-30 Dale Johannesen <dalej@apple.com> + + * gcc.c-torture/compile/pr24930.c: New. + +2005-11-30 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/15809 + * gfortran.dg/auto_char_dummy_array.f90: New test. + +2005-11-30 Jeff Law <law@redhat.com> + + * g++.old-deja/g++.law/pr25000.C: New test. + +2005-11-30 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/tls/opt-11.c: New test. + +2005-11-29 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.dg/torture/fp-int-convert-timode.c: XFAIL only on lp64 + targets. + * gcc.dg/torture/fp-int-convert-float128-timode.c: XFAIL also for + LP64 ia64. + +2005-11-29 Jakub Jelinek <jakub@redhat.com> + + * gfortran.dg/open_access_1.f90: New test. + +2005-11-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * gcc.dg/charset/builtin2.c: New test. + +2005-11-28 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/compat/struct-layout-1_generate.c: Add -w option + on mmix-*-* for *_[xy].c. + +2005-11-28 Kean Johnston <jkj@sco.com> + + * g++.dg/opt/range-test-1.C: Prevent re-inclusion of system + headers. + * g++.old-deja/g++.law/profile1.C: No longer expect fail on OSR5. + * gcc.c-torture/compile/20000804-1.c: Skip if using -fPIC on X86. + * gcc.target/i386/asm-3.c: Ditto. + * gcc.target/i386/clobbers.c: Ditto. + * gcc.dg/tree-ssa/ssa-dce-2.c: Make t() static and prototype it. + * gcc.target/i386/cmov1.c: Make magic* static so it matches the + test regexp. + * gcc.target/i386/mul.c: Ditto. + * gcc.target/i386/ssetype-1.c: Ditto. + * gcc.dg/20040813-1.c: Skip on SVR5 systems. + * gcc.c-torture/execute/builtins/strlen-3.c: Declare variables as + static so the test works with -fPIC mode too. Based on comment in + PR19231 by Pinski. + * gcc.dg/nest.c: No longer fail on SCO systems as it has -pg again. + +2005-11-28 Richard Guenther <rguenther@suse.de> + + * gcc.dg/alias-9.c: New testcase. + * g++.dg/warn/Wstrict-aliasing-7.C: Likewise. + +2005-11-28 Roger Sayle <roger@eyesopen.com> + Uros Bizjak <uros@kss-loka.si> + + PR middle-end/20219 + * gcc.dg/builtins-20.c: Add checks for sin(x)/tan(x) and + tan(x)/sin(x) transformations. + +2005-11-27 Andrew Pinski <pinskia@physics.uc.edu> + + PR middle-end/24575 + * gcc.dg/tree-ssa/divide-3.c: New test. + * gcc.dg/tree-ssa/divide-4.c: New test. + 2005-11-27 Steven G. Kargl <kargls@comcast.net> PR fortran/24917 diff --git a/gcc/testsuite/g++.dg/ext/packed8.C b/gcc/testsuite/g++.dg/ext/packed8.C index 13fc134bd97..1f86cfc0a69 100644 --- a/gcc/testsuite/g++.dg/ext/packed8.C +++ b/gcc/testsuite/g++.dg/ext/packed8.C @@ -15,7 +15,7 @@ public: class B { - A a __attribute__((packed)); + A a __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } public: B() {} diff --git a/gcc/testsuite/g++.dg/inherit/thunk5.C b/gcc/testsuite/g++.dg/inherit/thunk5.C new file mode 100644 index 00000000000..05dba36383d --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/thunk5.C @@ -0,0 +1,22 @@ +// PR c++/21123 + +struct A +{ + A(const A &a); + const A& operator=(const A& a); +}; + +struct B +{ + virtual A f(A); +}; + +struct C : virtual B +{ + virtual A f(A); +}; + +A C::f(A a) +{ + return a; +} diff --git a/gcc/testsuite/g++.dg/opt/pr7503-3.C b/gcc/testsuite/g++.dg/opt/pr7503-3.C index 4e8de0f207c..dc71d20638b 100644 --- a/gcc/testsuite/g++.dg/opt/pr7503-3.C +++ b/gcc/testsuite/g++.dg/opt/pr7503-3.C @@ -6,21 +6,21 @@ extern int A, B; void test1() { - (A++ <? B) = 0; // { dg-error "lvalue in assignment" } + (A++ <? B) = 0; // { dg-error "lvalue required" } } void test2() { - (A <? B++) = 0; // { dg-error "lvalue in assignment" } + (A <? B++) = 0; // { dg-error "lvalue required" } } void test3() { - (A++ >? B) = 0; // { dg-error "lvalue in assignment" } + (A++ >? B) = 0; // { dg-error "lvalue required" } } void test4() { - (A >? B++) = 0; // { dg-error "lvalue in assignment" } + (A >? B++) = 0; // { dg-error "lvalue required" } } diff --git a/gcc/testsuite/g++.dg/opt/range-test-1.C b/gcc/testsuite/g++.dg/opt/range-test-1.C index 9391748837e..cc5ba669479 100644 --- a/gcc/testsuite/g++.dg/opt/range-test-1.C +++ b/gcc/testsuite/g++.dg/opt/range-test-1.C @@ -2,9 +2,13 @@ // { dg-do run } */ // { dg-options "-O2" } */ +#ifndef __RANGE_TEST_HDR_INCL +#define __RANGE_TEST_HDR_INCL +/* Protect against fix-header weakness */ #include <stdlib.h> #include <stdio.h> #include <limits.h> +#endif #if (INT_MAX == 2147483647) && (INT_MIN == -2147483648) \ && (SCHAR_MIN == -128) && (SCHAR_MAX == 127) \ diff --git a/gcc/testsuite/g++.dg/other/array2.C b/gcc/testsuite/g++.dg/other/array2.C new file mode 100644 index 00000000000..b091d96bec8 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/array2.C @@ -0,0 +1,6 @@ +// PR c++/25263 +// { dg-do compile } + +int x[1/0]; // { dg-warning "division by zero" } + // { dg-error "constant" "constant" { target *-*-* } 4 } + diff --git a/gcc/testsuite/g++.dg/other/crash-4.C b/gcc/testsuite/g++.dg/other/crash-4.C index ea5a14fa7ae..a37b8b2f020 100644 --- a/gcc/testsuite/g++.dg/other/crash-4.C +++ b/gcc/testsuite/g++.dg/other/crash-4.C @@ -17,7 +17,7 @@ struct a struct b { // { dg-error "cannot bind packed field" "" { target { ! default_packed } } } char c; - a aa __attribute__((packed)); + a aa __attribute__((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } }; struct c { diff --git a/gcc/testsuite/g++.dg/other/default1.C b/gcc/testsuite/g++.dg/other/default1.C new file mode 100644 index 00000000000..a6d96818563 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/default1.C @@ -0,0 +1,22 @@ +// PR c++/24103 +// ICE in simple_cst_equal +// Origin: Alexander Stepanov <astepanov@softminecorp.com> +// { dg-do compile } +// { dg-options "" } + +struct S +{ + int i; +}; + +struct A +{ + A(S = (S){0}); +}; + +struct B +{ + B(S = (S){0}); +}; + +B::B(S) {} diff --git a/gcc/testsuite/g++.dg/other/packed1.C b/gcc/testsuite/g++.dg/other/packed1.C index d4422092271..5d19eb0e2a7 100644 --- a/gcc/testsuite/g++.dg/other/packed1.C +++ b/gcc/testsuite/g++.dg/other/packed1.C @@ -11,7 +11,11 @@ struct thing { int m; }; -struct pod {char a; thing m __attribute__ ((packed)); }; +struct pod + { + char a; + thing m __attribute__ ((packed)); // { dg-warning "attribute ignored" "" { target default_packed } } + }; int main () { diff --git a/gcc/testsuite/g++.dg/template/friend40.C b/gcc/testsuite/g++.dg/template/friend40.C new file mode 100644 index 00000000000..39dd994e9d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend40.C @@ -0,0 +1,16 @@ +// PR c++/24173 +// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } + +template <int> struct A; + +void foo(A<0>); + +template<int> struct A +{ + friend void foo(A<0>); +}; + +void bar() +{ + foo(A<0>()); +} diff --git a/gcc/testsuite/g++.dg/tls/diag-1.C b/gcc/testsuite/g++.dg/tls/diag-1.C index 697d0b13106..af538719d24 100644 --- a/gcc/testsuite/g++.dg/tls/diag-1.C +++ b/gcc/testsuite/g++.dg/tls/diag-1.C @@ -1,4 +1,5 @@ -/* Valid __thread specifiers. */ +// Valid __thread specifiers. +// { dg-require-effective-target tls } __thread int g1; extern __thread int g2; diff --git a/gcc/testsuite/g++.dg/tls/diag-2.C b/gcc/testsuite/g++.dg/tls/diag-2.C index 293409db9ce..484b1884515 100644 --- a/gcc/testsuite/g++.dg/tls/diag-2.C +++ b/gcc/testsuite/g++.dg/tls/diag-2.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */ diff --git a/gcc/testsuite/g++.dg/tls/diag-3.C b/gcc/testsuite/g++.dg/tls/diag-3.C index ae2b6ce211f..ea5158b898f 100644 --- a/gcc/testsuite/g++.dg/tls/diag-3.C +++ b/gcc/testsuite/g++.dg/tls/diag-3.C @@ -1,4 +1,5 @@ // Report invalid extern and __thread combinations. +// { dg-require-effective-target tls } extern int j; // { dg-error "previously declared here" } __thread int j; // { dg-error "follows non-thread-local" } diff --git a/gcc/testsuite/g++.dg/tls/diag-4.C b/gcc/testsuite/g++.dg/tls/diag-4.C index 3b840f1e7b9..55e985e9261 100644 --- a/gcc/testsuite/g++.dg/tls/diag-4.C +++ b/gcc/testsuite/g++.dg/tls/diag-4.C @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread typedef int g4; /* { dg-error "multiple storage classes" } */ diff --git a/gcc/testsuite/g++.dg/tls/init-1.C b/gcc/testsuite/g++.dg/tls/init-1.C index 74f7641fe27..97867123a95 100644 --- a/gcc/testsuite/g++.dg/tls/init-1.C +++ b/gcc/testsuite/g++.dg/tls/init-1.C @@ -1,4 +1,5 @@ /* Valid initializations. */ +/* { dg-require-effective-target tls } */ __thread int i = 42; diff --git a/gcc/testsuite/g++.dg/tls/init-2.C b/gcc/testsuite/g++.dg/tls/init-2.C index 4cc31c909ac..c9f646d3a1d 100644 --- a/gcc/testsuite/g++.dg/tls/init-2.C +++ b/gcc/testsuite/g++.dg/tls/init-2.C @@ -1,4 +1,5 @@ /* Invalid initializations. */ +/* { dg-require-effective-target tls } */ extern __thread int i; __thread int *p = &i; /* { dg-error "dynamically initialized" } */ diff --git a/gcc/testsuite/g++.dg/tls/static-1.C b/gcc/testsuite/g++.dg/tls/static-1.C index 3cbcbec2d31..2392c634619 100644 --- a/gcc/testsuite/g++.dg/tls/static-1.C +++ b/gcc/testsuite/g++.dg/tls/static-1.C @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } extern "C" void abort (); extern int test (); diff --git a/gcc/testsuite/g++.dg/tls/static-1a.cc b/gcc/testsuite/g++.dg/tls/static-1a.cc index c87efdb8ecd..636f9352d4d 100644 --- a/gcc/testsuite/g++.dg/tls/static-1a.cc +++ b/gcc/testsuite/g++.dg/tls/static-1a.cc @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-additional-sources "static-1a.cc" } +// { dg-require-effective-target tls_runtime } struct A { diff --git a/gcc/testsuite/g++.dg/tls/tls.exp b/gcc/testsuite/g++.dg/tls/tls.exp index 20c2bd35bcf..85e7a36fa7c 100644 --- a/gcc/testsuite/g++.dg/tls/tls.exp +++ b/gcc/testsuite/g++.dg/tls/tls.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,16 +19,6 @@ # Load support procs. load_lib g++-dg.exp -# Test for thread-local data supported by the platform. If it -# isn't, everything will fail with the "not supported" message. - -set comp_output [g++_target_compile \ - "$srcdir/$subdir/trivial.C" "trivialx.S" assembly ""] -remove-build-file "trivialx.S" -if { [string match "*not supported*" $comp_output] } { - return 0 -} - # If a testcase doesn't have special options, use these. global DEFAULT_CXXFLAGS if ![info exists DEFAULT_CXXFLAGS] then { diff --git a/gcc/testsuite/g++.dg/tls/trivial.C b/gcc/testsuite/g++.dg/tls/trivial.C index 1fd70631f33..e2b8f45b845 100644 --- a/gcc/testsuite/g++.dg/tls/trivial.C +++ b/gcc/testsuite/g++.dg/tls/trivial.C @@ -1 +1,3 @@ +// { dg-require-effective-target tls } + __thread int i; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr14814.C b/gcc/testsuite/g++.dg/tree-ssa/pr14814.C index c793f88f22f..59e3c9bc9b4 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr14814.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr14814.C @@ -14,7 +14,7 @@ int foo(XX& r) { if (r.direction().y() < 0.000001) return 0; return 1; } -/* { dg-final { scan-tree-dump-times "&this" 0 "forwprop2" { xfail *-*-* } } }*/ +/* { dg-final { scan-tree-dump-times "&this" 0 "forwprop2" } } */ /* { dg-final { scan-tree-dump-times "&r" 0 "forwprop2" } } */ /* { dg-final { cleanup-tree-dump "forwprop2" } } */ diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C new file mode 100644 index 00000000000..5e41808f6c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-7.C @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing -O2" } */ + +int a[2]; + +double *foo1(void) +{ + return (double *)a; /* { dg-warning "strict-aliasing" } */ +} + +double *foo2(void) +{ + return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */ +} + +__complex__ double x; +int *bar(void) +{ + return (int *)&__imag__ x; /* { dg-warning "strict-aliasing" } */ +} diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C new file mode 100644 index 00000000000..c5dea463b51 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-1.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wstring-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C new file mode 100644 index 00000000000..3eb91eeca49 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-2.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C new file mode 100644 index 00000000000..f700a51a87b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-3.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C new file mode 100644 index 00000000000..27f25f3ca98 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstring-literal-comparison-4.C @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -Wno-string-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C index a36cf0e7f17..b64f0fc257a 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C @@ -127,8 +127,8 @@ extern "C" { /* We can use weakref here without dg-require-weak, because we know the symbols are defined, so we don't actually issue the .weak directives. */ - void S3_s3 () __attribute__((__weakref__ ("_ZN2S32s3Ev"))); - void S4_s1 () __attribute__((__weakref__ ("_ZN2S42s1Ev"))); + static void S3_s3 () __attribute__((__weakref__ ("_ZN2S32s3Ev"))); + static void S4_s1 () __attribute__((__weakref__ ("_ZN2S42s1Ev"))); } // IA-64 uses function descriptors not function pointers in its vtables. diff --git a/gcc/testsuite/g++.old-deja/g++.law/pr25000.C b/gcc/testsuite/g++.old-deja/g++.law/pr25000.C new file mode 100644 index 00000000000..45d468020ef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.law/pr25000.C @@ -0,0 +1,24 @@ +// { dg-do compile } +// { dg-options "-O2" } +int * f(void); +void g(int*); +bool h(void); +void Find( ) +{ + int * pRes = f(); + if( !pRes ) { + if( h()){ + if( h()){ + try + { + pRes = new int(); + f(); + }catch(int& e1 ){} + } + if( !pRes ) + f(); + } + g(pRes); + } +} + diff --git a/gcc/testsuite/g++.old-deja/g++.law/profile1.C b/gcc/testsuite/g++.old-deja/g++.law/profile1.C index 56c52d1ef9a..acc20d0ad92 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/profile1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/profile1.C @@ -1,4 +1,4 @@ -// { dg-do run { xfail i[3456]86-*-sco3.2v5* } } +// { dg-do run } // { dg-require-profiling "-pg" } // { dg-options "-pg" } // { dg-options "-pg -static" { target hppa*-*-hpux* } } diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c index 782764b31bb..6942ae7c9ec 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20000804-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20000804-1.c @@ -1,6 +1,7 @@ /* This does not work on m68hc11 or h8300 due to the use of an asm statement to force a 'long long' (64-bits) to go in a register. */ /* { dg-do assemble { xfail m6811-*-* m6812-*-* h8300-*-* } } */ +/* { dg-skip-if "" { i?86-*-* } { "-fpic" "-fPIC" } { "" } } */ /* Copyright (C) 2000, 2003 Free Software Foundation */ __complex__ long long f () diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24930.c b/gcc/testsuite/gcc.c-torture/compile/pr24930.c new file mode 100644 index 00000000000..d52bb5c5057 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24930.c @@ -0,0 +1,17 @@ +/* PR 24930 */ +extern int foo(int u) __attribute__((noinline)); +int foo(int u) {return 0;} +int +main(int argc, char** argv) +{ + const char *buf = argv[1]; + + unsigned int data = (((unsigned int) buf[0]) << 8) + (unsigned int) buf[1]; + if (data & 0x8000) { + data &= 0x7fff ; + data ^= 0x7fff ; + data += 1 ; + data *= -1 ; + } + return foo((int)data); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c index 74075fdd3c6..221e306247a 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/strlen-3.c @@ -7,9 +7,9 @@ extern void abort (void); extern __SIZE_TYPE__ strlen (const char *); extern char *strcpy (char *, const char *); -const char bar[] = "Hello, World!"; -const char baz[] = "hello, world?"; -const char larger[20] = "short string"; +static const char bar[] = "Hello, World!"; +static const char baz[] = "hello, world?"; +static const char larger[20] = "short string"; extern volatile int inside_main; int l1 = 1; diff --git a/gcc/testsuite/gcc.dg/20030321-1.c b/gcc/testsuite/gcc.dg/20030321-1.c index 228acec5471..1150c7f7619 100644 --- a/gcc/testsuite/gcc.dg/20030321-1.c +++ b/gcc/testsuite/gcc.dg/20030321-1.c @@ -7,7 +7,7 @@ struct array { char align[4092]; - long long elem[2] __attribute__ ((__packed__)); + long long elem[2] __attribute__ ((__packed__)); /* { dg-warning "attribute ignored" "" { target default_packed } } */ }; long long diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c index aa8d166302d..a983886da29 100644 --- a/gcc/testsuite/gcc.dg/20040813-1.c +++ b/gcc/testsuite/gcc.dg/20040813-1.c @@ -2,7 +2,7 @@ /* Contributed by Devang Patel <dpatel@apple.com> */ /* { dg-do compile } */ -/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */ +/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-sysv5* } { "*" } { "" } } */ /* { dg-options "-gstabs" } */ int diff --git a/gcc/testsuite/gcc.dg/20041106-1.c b/gcc/testsuite/gcc.dg/20041106-1.c index 538f2dd8eb5..f83e835ed1d 100644 --- a/gcc/testsuite/gcc.dg/20041106-1.c +++ b/gcc/testsuite/gcc.dg/20041106-1.c @@ -6,7 +6,7 @@ #include <unistd.h> #include <stdlib.h> -struct S { long x __attribute__((packed)); }; +struct S { long x __attribute__((packed)); }; /* { dg-warning "attribute ignored" "" { target default_packed } } */ volatile long sink; void foo (struct S *s) diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c new file mode 100644 index 00000000000..c5dea463b51 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wstring-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c new file mode 100644 index 00000000000..3eb91eeca49 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; /* { dg-warning "comparison with string" } */ +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c new file mode 100644 index 00000000000..f700a51a87b --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c new file mode 100644 index 00000000000..27f25f3ca98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c @@ -0,0 +1,29 @@ +/* PR c/7776 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -Wno-string-literal-comparison" } */ + +int test1(char *ptr) +{ + return ptr == "foo"; +} + +int test2() +{ + return "foo" != (const char*)0; +} + +int test3() +{ + return "foo" == (const char*)0; +} + +int test4() +{ + return (const char*)0 != "foo"; +} + +int test5() +{ + return (const char*)0 == "foo"; +} + diff --git a/gcc/testsuite/gcc.dg/alias-9.c b/gcc/testsuite/gcc.dg/alias-9.c new file mode 100644 index 00000000000..6e9d4a83e35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-9.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstrict-aliasing -O2" } */ + +int a[2]; + +double *foo1(void) +{ + return (double *)a; /* { dg-warning "strict-aliasing" } */ +} + +double *foo2(void) +{ + return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */ +} + +_Complex x; +int *bar(void) +{ + return (int *)&__imag x; /* { dg-warning "strict-aliasing" } */ +} diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c index c47ce1e569b..7ffd64d55ca 100644 --- a/gcc/testsuite/gcc.dg/attr-weakref-1.c +++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c @@ -1,7 +1,9 @@ // { dg-do run } // { dg-require-weak "" } // { dg-options "-O2" } +// { dg-options "-O2 -mmacosx-version-min=10.2" { target { powerpc-*-darwin* } } } // { dg-additional-sources "attr-weakref-1a.c" } +// { dg-additional-sources "attr-weakref-1a.c attr-weakref-1b.c" { target { *-*-darwin* } } } // Copyright 2005 Free Software Foundation, Inc. // Contributed by Alexandre Oliva <aoliva@redhat.com> @@ -26,37 +28,32 @@ typedef int vtype; extern vtype wv1; -extern vtype Wv1a __attribute__((weakref ("wv1"))); +static vtype Wv1a __attribute__((weakref ("wv1"))); static vtype *pv1a USED = &Wv1a; -extern vtype Wv1b __attribute__((weak, weakref, alias ("wv1"))); -static vtype *pv1b USED = &Wv1b; -extern vtype Wv1c __attribute__((weakref)); -extern vtype Wv1c __attribute__((alias ("wv1"))); -static vtype *pv1c USED = &Wv1c; vtype gv2; -extern vtype Wv2a __attribute__((weakref ("gv2"))); +static vtype Wv2a __attribute__((weakref ("gv2"))); static vtype *pv2a USED = &Wv2a; static vtype lv3; -extern vtype Wv3a __attribute__((weakref ("lv3"))); +static vtype Wv3a __attribute__((weakref ("lv3"))); static vtype *pv3a USED = &Wv3a; extern vtype uv4; -extern vtype Wv4a __attribute__((weakref ("uv4"))); +static vtype Wv4a __attribute__((weakref ("uv4"))); static vtype *pv4a USED = &Wv4a; static vtype *pv4 USED = &uv4; -extern vtype Wv5a __attribute__((weakref ("uv5"))); +static vtype Wv5a __attribute__((weakref ("uv5"))); static vtype *pv5a USED = &Wv5a; extern vtype uv5; static vtype *pv5 USED = &uv5; -extern vtype Wv6a __attribute__((weakref ("wv6"))); +static vtype Wv6a __attribute__((weakref ("wv6"))); static vtype *pv6a USED = &Wv6a; extern vtype wv6; -extern vtype Wv7a __attribute__((weakref ("uv7"))); +static vtype Wv7a __attribute__((weakref ("uv7"))); static vtype* USED fv7 (void) { return &Wv7a; } @@ -69,71 +66,69 @@ extern vtype uv8; static vtype* USED fv8a (void) { return &uv8; } -extern vtype Wv8a __attribute__((weakref ("uv8"))); +static vtype Wv8a __attribute__((weakref ("uv8"))); static vtype* USED fv8 (void) { return &Wv8a; } extern vtype wv9 __attribute__((weak)); -extern vtype Wv9a __attribute__((weakref ("wv9"))); +static vtype Wv9a __attribute__((weakref ("wv9"))); static vtype *pv9a USED = &Wv9a; -extern vtype Wv10a __attribute__((weakref ("Wv10b"))); -extern vtype Wv10b __attribute__((weakref ("Wv10c"))); -extern vtype Wv10c __attribute__((weakref ("Wv10d"))); -extern vtype Wv10d __attribute__((weakref ("wv10"))); +static vtype Wv10a __attribute__((weakref ("Wv10b"))); +static vtype Wv10b __attribute__((weakref ("Wv10c"))); +static vtype Wv10c __attribute__((weakref ("Wv10d"))); +static vtype Wv10d __attribute__((weakref ("wv10"))); extern vtype wv10; extern vtype wv11; -extern vtype Wv11d __attribute__((weakref ("wv11"))); -extern vtype Wv11c __attribute__((weakref ("Wv11d"))); -extern vtype Wv11b __attribute__((weakref ("Wv11c"))); -extern vtype Wv11a __attribute__((weakref ("Wv11b"))); +static vtype Wv11d __attribute__((weakref ("wv11"))); +static vtype Wv11c __attribute__((weakref ("Wv11d"))); +static vtype Wv11b __attribute__((weakref ("Wv11c"))); +static vtype Wv11a __attribute__((weakref ("Wv11b"))); -extern vtype Wv12 __attribute__((weakref ("wv12"))); +static vtype Wv12 __attribute__((weakref ("wv12"))); extern vtype wv12 __attribute__((weak)); -extern vtype Wv13 __attribute__((weakref ("wv13"))); +static vtype Wv13 __attribute__((weakref ("wv13"))); extern vtype wv13 __attribute__((weak)); -extern vtype Wv14a __attribute__((weakref ("wv14"))); -extern vtype Wv14b __attribute__((weakref ("wv14"))); +static vtype Wv14a __attribute__((weakref ("wv14"))); +static vtype Wv14b __attribute__((weakref ("wv14"))); extern vtype wv14 __attribute__((weak)); typedef void ftype(void); extern ftype wf1; -extern ftype Wf1a __attribute__((weakref ("wf1"))); +static ftype Wf1a __attribute__((weakref ("wf1"))); static ftype *pf1a USED = &Wf1a; -extern ftype Wf1b __attribute__((weak, weakref, alias ("wf1"))); -static ftype *pf1b USED = &Wf1b; -extern ftype Wf1c __attribute__((weakref)); +static ftype Wf1c __attribute__((weakref)); extern ftype Wf1c __attribute__((alias ("wf1"))); static ftype *pf1c USED = &Wf1c; void gf2(void) {} -extern ftype Wf2a __attribute__((weakref ("gf2"))); +static ftype Wf2a __attribute__((weakref ("gf2"))); static ftype *pf2a USED = &Wf2a; static void lf3(void) {} -extern ftype Wf3a __attribute__((weakref ("lf3"))); +static ftype Wf3a __attribute__((weakref ("lf3"))); static ftype *pf3a USED = &Wf3a; extern ftype uf4; -extern ftype Wf4a __attribute__((weakref ("uf4"))); +static ftype Wf4a __attribute__((weakref ("uf4"))); static ftype *pf4a USED = &Wf4a; static ftype *pf4 USED = &uf4; -extern ftype Wf5a __attribute__((weakref ("uf5"))); +static ftype Wf5a __attribute__((weakref ("uf5"))); static ftype *pf5a USED = &Wf5a; extern ftype uf5; static ftype *pf5 USED = &uf5; -extern ftype Wf6a __attribute__((weakref ("wf6"))); +static ftype Wf6a __attribute__((weakref ("wf6"))); static ftype *pf6a USED = &Wf6a; extern ftype wf6; -extern ftype Wf7a __attribute__((weakref ("uf7"))); +static ftype Wf7a __attribute__((weakref ("uf7"))); static ftype* USED ff7 (void) { return &Wf7a; } @@ -146,43 +141,45 @@ extern ftype uf8; static ftype* USED ff8a (void) { return &uf8; } -extern ftype Wf8a __attribute__((weakref ("uf8"))); +static ftype Wf8a __attribute__((weakref ("uf8"))); static ftype* USED ff8 (void) { return &Wf8a; } extern ftype wf9 __attribute__((weak)); -extern ftype Wf9a __attribute__((weakref ("wf9"))); +static ftype Wf9a __attribute__((weakref ("wf9"))); static ftype *pf9a USED = &Wf9a; -extern ftype Wf10a __attribute__((weakref ("Wf10b"))); -extern ftype Wf10b __attribute__((weakref ("Wf10c"))); -extern ftype Wf10c __attribute__((weakref ("Wf10d"))); -extern ftype Wf10d __attribute__((weakref ("wf10"))); +static ftype Wf10a __attribute__((weakref ("Wf10b"))); +static ftype Wf10b __attribute__((weakref ("Wf10c"))); +static ftype Wf10c __attribute__((weakref ("Wf10d"))); +static ftype Wf10d __attribute__((weakref ("wf10"))); extern ftype wf10; extern ftype wf11; -extern ftype Wf11d __attribute__((weakref ("wf11"))); -extern ftype Wf11c __attribute__((weakref ("Wf11d"))); -extern ftype Wf11b __attribute__((weakref ("Wf11c"))); -extern ftype Wf11a __attribute__((weakref ("Wf11b"))); +static ftype Wf11d __attribute__((weakref ("wf11"))); +static ftype Wf11c __attribute__((weakref ("Wf11d"))); +static ftype Wf11b __attribute__((weakref ("Wf11c"))); +static ftype Wf11a __attribute__((weakref ("Wf11b"))); -extern ftype Wf12 __attribute__((weakref ("wf12"))); +static ftype Wf12 __attribute__((weakref ("wf12"))); extern ftype wf12 __attribute__((weak)); -extern ftype Wf13 __attribute__((weakref ("wf13"))); +static ftype Wf13 __attribute__((weakref ("wf13"))); extern ftype wf13 __attribute__((weak)); -extern ftype Wf14a __attribute__((weakref ("wf14"))); -extern ftype Wf14b __attribute__((weakref ("wf14"))); +static ftype Wf14a __attribute__((weakref ("wf14"))); +static ftype Wf14b __attribute__((weakref ("wf14"))); extern ftype wf14 __attribute__((weak)); +#ifndef __APPLE__ #define chk(p) do { if (!p) abort (); } while (0) +#else +#define chk(p) /* */ +#endif int main () { chk (!pv1a); - chk (!pv1b); - chk (!pv1c); chk (pv2a); chk (pv3a); chk (pv4a); @@ -203,7 +200,6 @@ int main () { chk (!&Wv14a); chk (!pf1a); - chk (!pf1b); chk (!pf1c); chk (pf2a); chk (pf3a); diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1b.c b/gcc/testsuite/gcc.dg/attr-weakref-1b.c new file mode 100644 index 00000000000..c2c43898c84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-weakref-1b.c @@ -0,0 +1,20 @@ +/* On Darwin, you have to have a definition of the function to link, + even if later on it won't be present in some dylib. (That is, + you have to link with the latest version of the dylib.) */ +void wf1(void) { } +void wf6(void) { } +void wf9(void) { } +void wf10(void) { } +void wf11(void) { } +void wf12(void) { } +void wf13(void) { } +void wf14(void) { } + +int wv1; +int wv6; +int wv9; +int wv10; +int wv11; +int wv12; +int wv13; +int wv14; diff --git a/gcc/testsuite/gcc.dg/attr-weakref-2.c b/gcc/testsuite/gcc.dg/attr-weakref-2.c new file mode 100644 index 00000000000..75cc0779c57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-weakref-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ + +typedef int vtype; + +extern vtype wv1; +extern vtype Wv1a __attribute__((weakref ("wv1"))); /* { dg-error "weakref 'Wv1a' must have static linkage" } */ diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c index dbcf96c3c07..a8ada8a8606 100644 --- a/gcc/testsuite/gcc.dg/builtins-20.c +++ b/gcc/testsuite/gcc.dg/builtins-20.c @@ -39,6 +39,12 @@ void test1(double x) if (cos(x)*tan(x) != sin(x)) link_error (); + + if (sin(x)/tan(x) != cos(x)) + link_error (); + + if (tan(x)/sin(x) != 1.0/cos(x)) + link_error (); } void test2(double x, double y) @@ -67,6 +73,12 @@ void test1f(float x) if (cosf(x)*tanf(x) != sinf(x)) link_error (); + + if (sinf(x)/tanf(x) != cosf(x)) + link_error (); + + if (tanf(x)/sinf(x) != 1.0f/cosf(x)) + link_error (); #endif } @@ -97,6 +109,12 @@ void test1l(long double x) if (cosl(x)*tanl(x) != sinl(x)) link_error (); + + if (sinl(x)/tanl(x) != cosl(x)) + link_error (); + + if (tanl(x)/sinl(x) != 1.0l/cosl(x)) + link_error (); #endif } diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-4.c b/gcc/testsuite/gcc.dg/c90-const-expr-4.c new file mode 100644 index 00000000000..6a449870ed3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-const-expr-4.c @@ -0,0 +1,11 @@ +/* Test for constant expressions: const variable with value 0 is not a + null pointer constant so the conditional expression should have + type void * and the assignment is OK. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -O2" } */ +int *p; +long *q; +static void *const n = 0; +int j; +void f(void) { q = j ? p : n; } diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-5.c b/gcc/testsuite/gcc.dg/c90-const-expr-5.c new file mode 100644 index 00000000000..132932b565a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-const-expr-5.c @@ -0,0 +1,39 @@ +/* Test null pointer constants: typedefs for void should be OK but not + qualified void. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +typedef void V; +int *p; +long *q; +int j; +void (*fp)(void); + +void +f (void) +{ + /* (V *)0 is a null pointer constant, so the assignment should be + diagnosed. */ + q = (j ? p : (V *)0); /* { dg-error "error: assignment from incompatible pointer type" } */ + q = (j ? p : (void *)0); /* { dg-error "error: 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 "error: ISO C forbids assignment between function pointer and 'void \\*'" } */ + fp = (void *)0; + fp = (V *)0; + fp = 0; + fp == 0; + 0 == fp; + fp == (void *)0; + (void *)0 == fp; + fp == (V *)0; + (V *)0 == fp; + fp == (V *)1; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + (V *)1 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + fp == (const void *)0; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + (const void *)0 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ +} diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-4.c b/gcc/testsuite/gcc.dg/c99-const-expr-4.c new file mode 100644 index 00000000000..f6beaf77a04 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-const-expr-4.c @@ -0,0 +1,11 @@ +/* Test for constant expressions: const variable with value 0 is not a + null pointer constant so the conditional expression should have + type void * and the assignment is OK. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -O2" } */ +int *p; +long *q; +static void *const n = 0; +int j; +void f(void) { q = j ? p : n; } diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-5.c b/gcc/testsuite/gcc.dg/c99-const-expr-5.c new file mode 100644 index 00000000000..e7fdf2c644b --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-const-expr-5.c @@ -0,0 +1,39 @@ +/* Test null pointer constants: typedefs for void should be OK but not + qualified void. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +typedef void V; +int *p; +long *q; +int j; +void (*fp)(void); + +void +f (void) +{ + /* (V *)0 is a null pointer constant, so the assignment should be + diagnosed. */ + q = (j ? p : (V *)0); /* { dg-error "error: assignment from incompatible pointer type" } */ + q = (j ? p : (void *)0); /* { dg-error "error: 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 "error: ISO C forbids assignment between function pointer and 'void \\*'" } */ + fp = (void *)0; + fp = (V *)0; + fp = 0; + fp == 0; + 0 == fp; + fp == (void *)0; + (void *)0 == fp; + fp == (V *)0; + (V *)0 == fp; + fp == (V *)1; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + (V *)1 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + fp == (const void *)0; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ + (const void *)0 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */ +} diff --git a/gcc/testsuite/gcc.dg/cast-pretty-print-1.c b/gcc/testsuite/gcc.dg/cast-pretty-print-1.c new file mode 100644 index 00000000000..e5ecec1a096 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cast-pretty-print-1.c @@ -0,0 +1,12 @@ +/* Test pretty-printing of casts. Should not depend on whether + NOP_EXPR or CONVERT_EXPR is used. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ +int i; +void +f (void) +{ + ((unsigned int)i)(); /* { dg-error "error: called object '\\(unsigned int\\)i' is not a function" } */ + ((char)i)(); /* { dg-error "error: called object '\\(char\\)i' is not a function" } */ +} diff --git a/gcc/testsuite/gcc.dg/charset/builtin2.c b/gcc/testsuite/gcc.dg/charset/builtin2.c new file mode 100644 index 00000000000..bfe9a20e25b --- /dev/null +++ b/gcc/testsuite/gcc.dg/charset/builtin2.c @@ -0,0 +1,32 @@ +/* Ensure that transformations of *printf are performed correctly + regardless of -fexec-charset. See PR 25120. */ + +/* { dg-do compile } */ +/* { dg-require-iconv "IBM1047" } */ +/* { dg-options "-O2 -fexec-charset=IBM1047" } */ +/* { dg-final { scan-assembler-not "printf" } } */ +/* { dg-final { scan-assembler-not "fprintf" } } */ +/* { dg-final { scan-assembler-not "sprintf" } } */ + +#include <stdio.h> + +void foo (char *dst, const char *src) +{ + printf ("\n"); + printf ("hello world\n"); + printf ("%s", "\n"); + printf ("%s", "hello world\n"); + printf ("%c", '\n'); + printf ("%s\n", "hello world"); + printf ("%s\n", src); + + fprintf (stdout, "\n"); + fprintf (stdout, "hello world\n"); + fprintf (stdout, "%s", "\n"); + fprintf (stdout, "%s", "hello world\n"); + fprintf (stdout, "%c", '\n'); + fprintf (stdout, "%s", src); + + sprintf (dst, "hello world\n"); + sprintf (dst, "%s", src); +} diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c index 1fb8f6bec0e..2f69575cb72 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -723,7 +723,7 @@ int main (void)\n\ fprintf (outfile, "\ /* { dg-options \"-w -I%s\" } */\n\ /* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* } } */\n\ -/* { dg-options \"-I%s -mno-base-addresses\" { target mmix-*-* } } */\n\ +/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\ #include \"struct-layout-1_x1.h\"\n\ #include \"t%03d_test.h\"\n\ #include \"struct-layout-1_x2.h\"\n\ @@ -736,7 +736,7 @@ int main (void)\n\ fprintf (outfile, "\ /* { dg-options \"-w -I%s\" } */\n\ /* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* } } */\n\ -/* { dg-options \"-I%s -mno-base-addresses\" { target mmix-*-* } } */\n\ +/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\ #include \"struct-layout-1_y1.h\"\n\ #include \"t%03d_test.h\"\n\ #include \"struct-layout-1_y2.h\"\n\ diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-3.c b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c new file mode 100644 index 00000000000..de6458c7398 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-require-weak "" } */ + +/* { dg-final { scan-assembler-not "coalesced" } } */ + +extern void foo(void) __attribute__((weak_import)); + +void foo(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/darwin-weakref-1.c b/gcc/testsuite/gcc.dg/darwin-weakref-1.c new file mode 100644 index 00000000000..22a3cc079a8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-weakref-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile { target *-*-darwin* } } */ +// { dg-require-weak "" } +// { dg-options "-O2" } +// { dg-options "-O2 -mmacosx-version-min=10.2" { target { powerpc-*-darwin* } } } +/* { dg-final { scan-assembler "weak_reference _wv1" } } */ +/* { dg-final { scan-assembler "weak_reference _wf1" } } */ +/* { dg-final { scan-assembler-not "weak_reference _w.2" } } */ + + +typedef int vtype; + +extern vtype wv1; +static vtype Wv1a __attribute__((weakref ("wv1"))); +vtype *pv1a = &Wv1a; + +extern vtype wv2; +static vtype Wv2a __attribute__((weakref ("wv2"))); +vtype *pv2a = &wv2; + +typedef void ftype(void); + +extern ftype wf1; +static ftype Wf1a __attribute__((weakref ("wf1"))); +ftype *pf1a = &Wf1a; + +extern ftype wf2; +static ftype Wf2a __attribute__((weakref ("wf2"))); +ftype *pf2a = &wf2; diff --git a/gcc/testsuite/gcc.dg/format/cast-1.c b/gcc/testsuite/gcc.dg/format/cast-1.c new file mode 100644 index 00000000000..78a4f527d9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/cast-1.c @@ -0,0 +1,16 @@ +/* Test for strings cast through integer types: should not be treated + as format strings unless the types are of the same width as + pointers (intptr_t or similar). */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +#include "format.h" + +void +f (int x) +{ + printf("%s", x); /* { dg-warning "format" } */ + printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */ + printf((char *)(char)"%s", x); +} diff --git a/gcc/testsuite/gcc.dg/lvalue-2.c b/gcc/testsuite/gcc.dg/lvalue-2.c index 5ad648eece9..c512aef8394 100644 --- a/gcc/testsuite/gcc.dg/lvalue-2.c +++ b/gcc/testsuite/gcc.dg/lvalue-2.c @@ -9,12 +9,12 @@ int a, b; void f0 (void) { - (a+b) = 1; /* { dg-error "error: invalid lvalue in assignment" } */ - (a+b)++; /* { dg-error "error: invalid lvalue in increment" } */ - ++(a+b); /* { dg-error "error: invalid lvalue in increment" } */ - (a+b)--; /* { dg-error "error: invalid lvalue in decrement" } */ - --(a+b); /* { dg-error "error: invalid lvalue in decrement" } */ - &(a+b); /* { dg-error "error: invalid lvalue in unary '&'" } */ + (a+b) = 1; /* { dg-error "error: lvalue required as left operand of assignment" } */ + (a+b)++; /* { dg-error "error: lvalue required as increment operand" } */ + ++(a+b); /* { dg-error "error: lvalue required as increment operand" } */ + (a+b)--; /* { dg-error "error: lvalue required as decrement operand" } */ + --(a+b); /* { dg-error "error: lvalue required as decrement operand" } */ + &(a+b); /* { dg-error "error: lvalue required as unary '&' operand" } */ } const int c; diff --git a/gcc/testsuite/gcc.dg/lvalue1.c b/gcc/testsuite/gcc.dg/lvalue1.c index 7e21608ab36..67b013078c8 100644 --- a/gcc/testsuite/gcc.dg/lvalue1.c +++ b/gcc/testsuite/gcc.dg/lvalue1.c @@ -4,6 +4,6 @@ int main() { int i; - +i = 1; /* { dg-error "invalid lvalue in assignment" } */ + +i = 1; /* { dg-error "lvalue required as left operand of assignment" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/nest.c b/gcc/testsuite/gcc.dg/nest.c index 89ecdd58a06..b9476600ae2 100644 --- a/gcc/testsuite/gcc.dg/nest.c +++ b/gcc/testsuite/gcc.dg/nest.c @@ -4,7 +4,6 @@ /* { dg-options "-O2 -pg" } */ /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */ -/* { dg-error "-pg not supported" "Profiler support missing" { target *-*-sco3.2v5* } 0 } */ /* { dg-bogus "\[Uu\]nresolved symbol ._mcount" "Profiling unsupported" { xfail *-*-netware* } 0 } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/pr17112-1.c b/gcc/testsuite/gcc.dg/pr17112-1.c index 7c8b7aa0432..09c3758abed 100644 --- a/gcc/testsuite/gcc.dg/pr17112-1.c +++ b/gcc/testsuite/gcc.dg/pr17112-1.c @@ -5,7 +5,7 @@ extern void abort(void); typedef struct { - int int24:24 __attribute__ ((packed)); + int int24:24 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" { target { default_packed && { ! pcc_bitfield_type_matters } } } } */ } myint24; myint24 x[3] = { diff --git a/gcc/testsuite/gcc.dg/pr17730-1.c b/gcc/testsuite/gcc.dg/pr17730-1.c index 0fede2f6d6c..fe9be68eff6 100644 --- a/gcc/testsuite/gcc.dg/pr17730-1.c +++ b/gcc/testsuite/gcc.dg/pr17730-1.c @@ -2,4 +2,4 @@ /* { dg-do compile } */ /* { dg-options "" } */ -char *p = &'C'; /* { dg-error "error: invalid lvalue in unary '&'" } */ +char *p = &'C'; /* { dg-error "error: lvalue required as unary '&' operand" } */ diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c index 1098190ebd0..28cb47e5041 100644 --- a/gcc/testsuite/gcc.dg/tls/alias-1.c +++ b/gcc/testsuite/gcc.dg/tls/alias-1.c @@ -1,6 +1,7 @@ /* { dg-do link } */ /* { dg-require-alias "" } */ /* { dg-require-visibility "" } */ +/* { dg-require-effective-target tls } */ /* Test that encode_section_info handles the change from externally defined to locally defined (via hidden). Extracted from glibc. */ diff --git a/gcc/testsuite/gcc.dg/tls/alpha-1.c b/gcc/testsuite/gcc.dg/tls/alpha-1.c index 4bb911f74a1..1d15cb1681c 100644 --- a/gcc/testsuite/gcc.dg/tls/alpha-1.c +++ b/gcc/testsuite/gcc.dg/tls/alpha-1.c @@ -1,6 +1,7 @@ /* Make sure that we honor initial-exec. */ /* { dg-do compile { target alpha*-*-* } } */ /* { dg-options "" } */ +/* { dg-require-effective-target tls } */ static __thread int xyzzy __attribute__ ((tls_model ("initial-exec"))); int foo(void) { return xyzzy; } diff --git a/gcc/testsuite/gcc.dg/tls/asm-1.c b/gcc/testsuite/gcc.dg/tls/asm-1.c index 476fe7cbb72..b77e550d7bf 100644 --- a/gcc/testsuite/gcc.dg/tls/asm-1.c +++ b/gcc/testsuite/gcc.dg/tls/asm-1.c @@ -1,4 +1,5 @@ /* { dg-options "-Werror" } */ +/* { dg-require-effective-target tls } */ __thread int i; int foo () diff --git a/gcc/testsuite/gcc.dg/tls/debug-1.c b/gcc/testsuite/gcc.dg/tls/debug-1.c index 719f0645771..67d7be69cc5 100644 --- a/gcc/testsuite/gcc.dg/tls/debug-1.c +++ b/gcc/testsuite/gcc.dg/tls/debug-1.c @@ -1,4 +1,5 @@ /* { dg-do assemble } */ /* { dg-options "-g" } */ +/* { dg-require-effective-target tls } */ __thread int i; diff --git a/gcc/testsuite/gcc.dg/tls/diag-1.c b/gcc/testsuite/gcc.dg/tls/diag-1.c index ae4f3d4a3c2..56b570c94a5 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-1.c +++ b/gcc/testsuite/gcc.dg/tls/diag-1.c @@ -1,4 +1,5 @@ /* Valid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread int g1; extern __thread int g2; diff --git a/gcc/testsuite/gcc.dg/tls/diag-2.c b/gcc/testsuite/gcc.dg/tls/diag-2.c index 5e7e17bee5a..8276cb3be49 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-2.c +++ b/gcc/testsuite/gcc.dg/tls/diag-2.c @@ -1,4 +1,5 @@ /* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-3.c b/gcc/testsuite/gcc.dg/tls/diag-3.c index f1ce06b70d8..45d89b43722 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-3.c +++ b/gcc/testsuite/gcc.dg/tls/diag-3.c @@ -1,4 +1,5 @@ /* Report invalid extern and __thread combinations. */ +/* { dg-require-effective-target tls } */ extern int j; /* { dg-error "previous declaration" } */ __thread int j; /* { dg-error "follows non-thread-local" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-4.c b/gcc/testsuite/gcc.dg/tls/diag-4.c index df3705d04ee..fed2f3accd3 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-4.c +++ b/gcc/testsuite/gcc.dg/tls/diag-4.c @@ -1,5 +1,6 @@ /* Invalid __thread specifiers. As diag-4.c but some cases in different orders. */ +/* { dg-require-effective-target tls } */ __thread typedef int g4; /* { dg-error "'__thread' used with 'typedef'" } */ diff --git a/gcc/testsuite/gcc.dg/tls/diag-5.c b/gcc/testsuite/gcc.dg/tls/diag-5.c index 623832c3812..219396d768a 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-5.c +++ b/gcc/testsuite/gcc.dg/tls/diag-5.c @@ -1,3 +1,4 @@ /* __thread specifiers on empty declarations. */ +/* { dg-require-effective-target tls } */ __thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */ diff --git a/gcc/testsuite/gcc.dg/tls/init-1.c b/gcc/testsuite/gcc.dg/tls/init-1.c index 97258643bf2..fa4208dce0c 100644 --- a/gcc/testsuite/gcc.dg/tls/init-1.c +++ b/gcc/testsuite/gcc.dg/tls/init-1.c @@ -1,4 +1,5 @@ /* Invalid initializations. */ +/* { dg-require-effective-target tls } */ extern __thread int i; int *p = &i; /* { dg-error "initializer element is not constant" } */ diff --git a/gcc/testsuite/gcc.dg/tls/nonpic-1.c b/gcc/testsuite/gcc.dg/tls/nonpic-1.c index 0896df60b56..9c592a98556 100644 --- a/gcc/testsuite/gcc.dg/tls/nonpic-1.c +++ b/gcc/testsuite/gcc.dg/tls/nonpic-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -ftls-model=initial-exec" } */ +/* { dg-require-effective-target tls } */ extern __thread long e1; extern __thread int e2; diff --git a/gcc/testsuite/gcc.dg/tls/opt-1.c b/gcc/testsuite/gcc.dg/tls/opt-1.c index f7dcceee7c8..5bada6e0929 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-1.c +++ b/gcc/testsuite/gcc.dg/tls/opt-1.c @@ -2,6 +2,7 @@ /* { dg-options "-O2 -fPIC" } */ /* { dg-options "-O2 -fPIC -mtune=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O2 -fPIC -mtune=i686" { target { x86_64-*-* && ilp32 } } } */ +/* { dg-require-effective-target tls } */ extern __thread int thr; diff --git a/gcc/testsuite/gcc.dg/tls/opt-10.c b/gcc/testsuite/gcc.dg/tls/opt-10.c index f31c1fff816..a710a062ca3 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-10.c +++ b/gcc/testsuite/gcc.dg/tls/opt-10.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fpic" } */ +/* { dg-require-effective-target tls } */ /* The web pass was creating unrecognisable pic_load_dot_plus_four insns on ARM. */ diff --git a/gcc/testsuite/gcc.dg/tls/opt-11.c b/gcc/testsuite/gcc.dg/tls/opt-11.c new file mode 100644 index 00000000000..3739645257a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/opt-11.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ + +extern void abort (void); +extern void *memset (void *, int, __SIZE_TYPE__); + +struct A +{ + char pad[48]; + int i; + int pad2; + int j; +}; +__thread struct A a; + +int * +__attribute__((noinline)) +foo (void) +{ + return &a.i; +} + +int +main (void) +{ + int *p = foo (); + memset (&a, 0, sizeof (a)); + a.i = 6; + a.j = 8; + if (p[0] != 6 || p[1] != 0 || p[2] != 8) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tls/opt-2.c b/gcc/testsuite/gcc.dg/tls/opt-2.c index dde54f00674..fd781ebabd1 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-2.c +++ b/gcc/testsuite/gcc.dg/tls/opt-2.c @@ -6,6 +6,7 @@ /* { dg-options "-O2 -ftls-model=initial-exec" } */ /* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { x86_64-*-* && ilp32 } } } */ +/* { dg-require-effective-target tls } */ __thread int thr; diff --git a/gcc/testsuite/gcc.dg/tls/opt-3.c b/gcc/testsuite/gcc.dg/tls/opt-3.c index 8e476f657e8..e59e5110b5b 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-3.c +++ b/gcc/testsuite/gcc.dg/tls/opt-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fpic" } */ /* { dg-options "-O2 -fpic -mregparm=3" { target i?86-*-* } } */ +/* { dg-require-effective-target tls } */ extern __thread int i, j, k; extern void bar(int *, int *, int *); diff --git a/gcc/testsuite/gcc.dg/tls/opt-4.c b/gcc/testsuite/gcc.dg/tls/opt-4.c index 3a95688963b..aa59ee7fabf 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-4.c +++ b/gcc/testsuite/gcc.dg/tls/opt-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ struct A { diff --git a/gcc/testsuite/gcc.dg/tls/opt-5.c b/gcc/testsuite/gcc.dg/tls/opt-5.c index d8a686ddb46..0604f3253c1 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-5.c +++ b/gcc/testsuite/gcc.dg/tls/opt-5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ /* Sched1 moved {load_tp} pattern between strlen call and the copy of the hard return value to its pseudo. This resulted in a reload abort, since the hard register was not spillable. */ diff --git a/gcc/testsuite/gcc.dg/tls/opt-6.c b/gcc/testsuite/gcc.dg/tls/opt-6.c index de04c1cb3fc..8a01c019c10 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-6.c +++ b/gcc/testsuite/gcc.dg/tls/opt-6.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/tls/opt-7.c b/gcc/testsuite/gcc.dg/tls/opt-7.c index beb2c2622d4..c345068a203 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-7.c +++ b/gcc/testsuite/gcc.dg/tls/opt-7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fPIC" } */ +/* { dg-require-effective-target tls } */ static __thread void *baz [4] __attribute__((tls_model ("initial-exec"))); void foo (void) diff --git a/gcc/testsuite/gcc.dg/tls/opt-8.c b/gcc/testsuite/gcc.dg/tls/opt-8.c index dec0eabcb4c..a7331115352 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-8.c +++ b/gcc/testsuite/gcc.dg/tls/opt-8.c @@ -1,6 +1,7 @@ /* PR 18910 */ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls } */ static __thread void *foo [2]; void diff --git a/gcc/testsuite/gcc.dg/tls/opt-9.c b/gcc/testsuite/gcc.dg/tls/opt-9.c index 3829c66fc55..cc62ef57a5d 100644 --- a/gcc/testsuite/gcc.dg/tls/opt-9.c +++ b/gcc/testsuite/gcc.dg/tls/opt-9.c @@ -1,6 +1,7 @@ /* PR 21412 */ /* { dg-do compile */ /* { dg-options "-O2 -fPIC" } */ +/* { dg-require-effective-target tls } */ struct S { int x[10]; }; extern __thread struct S s; diff --git a/gcc/testsuite/gcc.dg/tls/pic-1.c b/gcc/testsuite/gcc.dg/tls/pic-1.c index f5b020b7db6..bcd42bd8572 100644 --- a/gcc/testsuite/gcc.dg/tls/pic-1.c +++ b/gcc/testsuite/gcc.dg/tls/pic-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */ +/* { dg-require-effective-target tls } */ extern __thread long e1; extern __thread int e2; diff --git a/gcc/testsuite/gcc.dg/tls/pr24428-2.c b/gcc/testsuite/gcc.dg/tls/pr24428-2.c index 828943c60e5..a0ceecc0624 100644 --- a/gcc/testsuite/gcc.dg/tls/pr24428-2.c +++ b/gcc/testsuite/gcc.dg/tls/pr24428-2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls_runtime } */ __thread double thrtest[81]; int main () diff --git a/gcc/testsuite/gcc.dg/tls/pr24428.c b/gcc/testsuite/gcc.dg/tls/pr24428.c index 53b1245d509..ecb747ede6d 100644 --- a/gcc/testsuite/gcc.dg/tls/pr24428.c +++ b/gcc/testsuite/gcc.dg/tls/pr24428.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target tls_runtime } */ __thread double thrtest[81]; int main () diff --git a/gcc/testsuite/gcc.dg/tls/section-1.c b/gcc/testsuite/gcc.dg/tls/section-1.c index 741eadba536..4fc5066b90d 100644 --- a/gcc/testsuite/gcc.dg/tls/section-1.c +++ b/gcc/testsuite/gcc.dg/tls/section-1.c @@ -1,5 +1,6 @@ /* Verify that we get errors for trying to put TLS data in sections which can't work. */ +/* { dg-require-effective-target tls } */ #define A(X) __attribute__((section(X))) diff --git a/gcc/testsuite/gcc.dg/tls/struct-1.c b/gcc/testsuite/gcc.dg/tls/struct-1.c index 11151236d90..5fd6be43905 100644 --- a/gcc/testsuite/gcc.dg/tls/struct-1.c +++ b/gcc/testsuite/gcc.dg/tls/struct-1.c @@ -2,6 +2,7 @@ to allow addends for @dtpoff relocs or not. */ /* { dg-do compile } */ /* { dg-options "-O2 -fpic" } */ +/* { dg-require-effective-target tls } */ struct S { int s0, s1, s2, s3; diff --git a/gcc/testsuite/gcc.dg/tls/tls.exp b/gcc/testsuite/gcc.dg/tls/tls.exp index b168a1e6190..cd86231c050 100644 --- a/gcc/testsuite/gcc.dg/tls/tls.exp +++ b/gcc/testsuite/gcc.dg/tls/tls.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,16 +19,6 @@ # Load support procs. load_lib gcc-dg.exp -# Test for thread-local data supported by the platform. If it -# isn't, everything will fail with the "not supported" message. - -set comp_output [gcc_target_compile \ - "$srcdir/$subdir/trivial.c" "trivial.S" assembly ""] -remove-build-file "trivial.S" -if { [string match "*not supported*" $comp_output] } { - return 0 -} - # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS if ![info exists DEFAULT_CFLAGS] then { diff --git a/gcc/testsuite/gcc.dg/tls/trivial.c b/gcc/testsuite/gcc.dg/tls/trivial.c index 1fd70631f33..96b8e49a665 100644 --- a/gcc/testsuite/gcc.dg/tls/trivial.c +++ b/gcc/testsuite/gcc.dg/tls/trivial.c @@ -1 +1,3 @@ +/* { dg-require-effective-target tls } */ + __thread int i; diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c index 30250d86d9e..e9538318f69 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c @@ -2,6 +2,7 @@ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ /* { dg-xfail-if "" { i?86-*-* x86_64-*-* } { "*" } { "" } } */ +/* { dg-xfail-if "" { ia64-*-* && lp64 } { "*" } { "" } } */ /* { dg-options "" } */ /* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */ /* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */ diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c index 11c02a321ca..e60b5409d5f 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c @@ -1,6 +1,6 @@ /* Test floating-point conversions. TImode types. */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run { xfail lp64 } } */ /* { dg-options "" } */ #include <float.h> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c index 6d15c7b5053..8708fe12dcf 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c @@ -25,5 +25,5 @@ struct s foo (struct s r) /* There should be no references to any of "temp_struct*" temporaries. */ -/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c b/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c new file mode 100644 index 00000000000..fa3e35a6a0b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(int a) +{ + return -(a/10); +} + +/* { dg-final { scan-tree-dump-times "a / 10" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "a / -10" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c b/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c new file mode 100644 index 00000000000..38c68cf6e8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +int f(int a) +{ + return -(-a/10); +} + +/* { dg-final { scan-tree-dump-times "-a / 10" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "a / 10" 1 "optimized"} } */ + +/* { dg-final { cleanup-tree-dump "optimized" } } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c index 81a11a97bda..655f61c6f73 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c @@ -2,11 +2,11 @@ /* { dg-options "-O2 -fdump-tree-dce3" } */ /* We should notice constantness of this function. */ -int t(int a) +static int __attribute__((noinline)) t(int a) { return a+1; } -q() +void q(void) { int i = t(1); if (!i) diff --git a/gcc/testsuite/gcc.dg/vect/vect-62.c b/gcc/testsuite/gcc.dg/vect/vect-62.c index 433b8bf3571..79f8876155e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-62.c +++ b/gcc/testsuite/gcc.dg/vect/vect-62.c @@ -66,5 +66,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "not vectorized: redundant loop. no profit to vectorize." 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c index 40213e80acf..8539b6036ee 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-76.c +++ b/gcc/testsuite/gcc.dg/vect/vect-76.c @@ -69,7 +69,6 @@ int main (void) } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_no_align } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c index 418687dd23b..38bb91727c6 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c @@ -46,5 +46,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c index 91d7abd1275..cb2293fe3df 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c @@ -46,5 +46,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c index f8a7b96fbc9..aecf8a512e1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c @@ -45,5 +45,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c index d4ac128563c..4476c83d0e7 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c @@ -44,5 +44,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.target/i386/asm-3.c b/gcc/testsuite/gcc.target/i386/asm-3.c index 19bf1534521..e85d1c1ebdd 100644 --- a/gcc/testsuite/gcc.target/i386/asm-3.c +++ b/gcc/testsuite/gcc.target/i386/asm-3.c @@ -1,6 +1,7 @@ /* PR inline-asm/6806 */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "" { i?86-*-* } { "-fpic" "-fPIC" } { "" } } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/clobbers.c b/gcc/testsuite/gcc.target/i386/clobbers.c index 44c46b0bf02..91179a9d1ca 100644 --- a/gcc/testsuite/gcc.target/i386/clobbers.c +++ b/gcc/testsuite/gcc.target/i386/clobbers.c @@ -1,6 +1,7 @@ /* Test asm clobbers on x86. */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-skip-if "" { i?86-*-* } { "-fpic" "-fPIC" } { "" } } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/cmov1.c b/gcc/testsuite/gcc.target/i386/cmov1.c index 71f03ae9fea..9252d868f96 100644 --- a/gcc/testsuite/gcc.target/i386/cmov1.c +++ b/gcc/testsuite/gcc.target/i386/cmov1.c @@ -9,15 +9,15 @@ /* Check code generation for several conditional moves doable by single arithmetics. */ -int magic_namea; -char magic_nameb; -short magic_namec; -int magic_named; -char magic_namee; -short magic_namef; +static int magic_namea; +static char magic_nameb; +static short magic_namec; +static int magic_named; +static char magic_namee; +static short magic_namef; unsigned int gen; -m() +void m(void) { magic_namec=magic_namec>=0?0:-1; magic_namea=magic_namea>=0?0:-1; diff --git a/gcc/testsuite/gcc.target/i386/movq-2.c b/gcc/testsuite/gcc.target/i386/movq-2.c new file mode 100644 index 00000000000..98979646f37 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movq-2.c @@ -0,0 +1,26 @@ +/* PR target/25199 */ +/* { dg-do compile } */ +/* { dg-options "-Os -mtune=pentium4" } */ +/* { dg-require-effective-target ilp32 } */ + +struct S +{ + void *p[30]; + unsigned char c[4]; +}; + +unsigned char d; + +void +foo (struct S *x) +{ + register unsigned char e __asm ("esi"); + e = x->c[3]; + __asm __volatile ("" : : "r" (e)); + e = x->c[0]; + __asm __volatile ("" : : "r" (e)); +} + +/* { dg-final { scan-assembler-not "movl\[ \t\]*123" } } */ +/* { dg-final { scan-assembler "movzbl\[ \t\]*123" } } */ +/* { dg-final { scan-assembler "movl\[ \t\]*120" } } */ diff --git a/gcc/testsuite/gcc.target/i386/movq.c b/gcc/testsuite/gcc.target/i386/movq.c index cdb35ede8de..ac0dfa2d94d 100644 --- a/gcc/testsuite/gcc.target/i386/movq.c +++ b/gcc/testsuite/gcc.target/i386/movq.c @@ -1,5 +1,7 @@ -/* { dg-do compile { target "i?86*-*-*" } } +/* { dg-do compile } /* { dg-options "-Os -march=pentium4 -mtune=prescott" } */ +/* { dg-require-effective-target ilp32 } */ + register char foo asm("edi"); char x; int bar() { diff --git a/gcc/testsuite/gcc.target/i386/mul.c b/gcc/testsuite/gcc.target/i386/mul.c index 2a864af76d0..72069fe2cf8 100644 --- a/gcc/testsuite/gcc.target/i386/mul.c +++ b/gcc/testsuite/gcc.target/i386/mul.c @@ -3,8 +3,8 @@ /* { dg-final { scan-assembler "and\[^\\n\]*magic" } } */ /* Should be done as "andw $32767, magic". */ -unsigned short magic; -t() +static unsigned short magic; +void t(void) { magic%=(unsigned short)0x8000U; } diff --git a/gcc/testsuite/gcc.target/i386/ssetype-1.c b/gcc/testsuite/gcc.target/i386/ssetype-1.c index 50d0fcaa58a..47a68918d8c 100644 --- a/gcc/testsuite/gcc.target/i386/ssetype-1.c +++ b/gcc/testsuite/gcc.target/i386/ssetype-1.c @@ -11,7 +11,7 @@ #include <xmmintrin.h> -__m128d magic_a, magic_b; +static __m128d magic_a, magic_b; __m128d t1(void) diff --git a/gcc/testsuite/gcc.target/powerpc/pr18096-1.c b/gcc/testsuite/gcc.target/powerpc/pr18096-1.c index b11f71ae984..9c4c0cf9244 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr18096-1.c +++ b/gcc/testsuite/gcc.target/powerpc/pr18096-1.c @@ -8,5 +8,5 @@ void mkcatdefs(char *fname) { char line [2147483647]; f(line); -} /* { dg-warning "stack frame too large" "stack frame too large" } */ +} /* { dg-warning "too large" "stack frame too large" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/rotate.c b/gcc/testsuite/gcc.target/powerpc/rotate.c new file mode 100644 index 00000000000..5d47215d9d5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rotate.c @@ -0,0 +1,6 @@ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "slwi" } } */ +unsigned int foo (unsigned int x) +{ + return ((x >> 16) & 0xffff) | ((x & 0xffff) << 16); +} diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-P.c new file mode 100644 index 00000000000..bf473616abb --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-P.c @@ -0,0 +1,8 @@ +/* { dg-do run { target { *-*-* && yes } } } */ +/* { dg-skip-if "comment" { no && yes } { "*" } { "" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-U.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-U.c new file mode 100644 index 00000000000..65008c8ab28 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-sif-exp-U.c @@ -0,0 +1,8 @@ +/* { dg-do run { target { *-*-* || no } } } */ +/* { dg-skip-if "comment" { *-*-* && yes } { "*" } { "" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-P.c new file mode 100644 index 00000000000..eb2af26081f --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-P.c @@ -0,0 +1,8 @@ +/* { dg-do run { target { *-*-* && yes } } } */ +/* { dg-xfail-if "comment" { empty-*-* && yes } { "*" } { "" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-XP.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-XP.c new file mode 100644 index 00000000000..59cb7689401 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-xif-exp-XP.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { *-*-* empty-*-* } } } */ +/* { dg-xfail-if "comment" { *-*-* && yes } { "*" } { "" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.test-framework/test-framework.exp b/gcc/testsuite/gcc.test-framework/test-framework.exp index 2e4236a584b..495ffe2cb99 100644 --- a/gcc/testsuite/gcc.test-framework/test-framework.exp +++ b/gcc/testsuite/gcc.test-framework/test-framework.exp @@ -51,6 +51,12 @@ dg-init # Run tests from the source directory. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dg-*.c]] "" "" +# Skip generated tests unless CHECK_TEST_FRAMEWORK is 1. +if { $env(CHECK_TEST_FRAMEWORK) != 1 } { + verbose "skipping generated test framework tests, CHECK_TEST_FRAMEWORK is not 1" 0 + return +} + # Generate additional tests. set tstobjdir "$tmpdir/gcc.test-framework" set generator "$srcdir/$subdir/gen_directive_tests" diff --git a/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90 b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90 new file mode 100644 index 00000000000..2ee98cfcc80 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90 @@ -0,0 +1,56 @@ +! { dg-do run } +! This tests the fix for pr15809 in which automatic character length, +! dummy, pointer arrays were broken. +! +! contributed by Paul Thomas <pault@gcc.gnu.org> +! +module global + character(12), dimension(2), target :: t +end module global + +program oh_no_not_pr15908_again + character(12), dimension(:), pointer :: ptr + + call a (ptr, 12) + if (.not.associated (ptr) ) call abort () + if (any (ptr.ne."abc")) call abort () + + ptr => null () ! ptr points to 't' here. + allocate (ptr(3)) + ptr = "xyz" + call a (ptr, 12) + + if (.not.associated (ptr)) call abort () + if (any (ptr.ne."lmn")) call abort () + + call a (ptr, 0) + + if (associated (ptr)) call abort () + +contains + + subroutine a (p, l) + use global + character(l), dimension(:), pointer :: p + character(l), dimension(3) :: s + + s = "lmn" + + if (l.ne.12) then + deallocate (p) ! ptr was allocated in main. + p => null () + return + end if + + if (.not.associated (p)) then + t = "abc" + p => t + else + if (size (p,1).ne.3) call abort () + if (any (p.ne."xyz")) call abort () + p = s + end if + end subroutine a + +end program oh_no_not_pr15908_again + diff --git a/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90 b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90 new file mode 100644 index 00000000000..666418301e5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_2.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! Test fix for pr24789 - would segfault on the assignment +! because the array descriptor size was not set. +! +! This is the example submitted by Martin Reineke <martin@mpa-garching.mpg.de> + +subroutine foo(vals) + character(len = *), pointer :: vals(:) + vals = '' +end subroutine + diff --git a/gcc/testsuite/gfortran.dg/line_length_1.f b/gcc/testsuite/gfortran.dg/line_length_1.f new file mode 100644 index 00000000000..1ac80338d89 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/line_length_1.f @@ -0,0 +1,7 @@ +! Testcase for -ffixed-line-length-none +! { dg-do compile } +! { dg-options "-ffixed-line-length-none" } + program one + if (abs(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).gt.999.d0.or.abs(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb).gt.999.d0.or.abs(cccccccccccccccccccc).gt.999.d0) THEN + endif + end program one diff --git a/gcc/testsuite/gfortran.dg/line_length_2.f90 b/gcc/testsuite/gfortran.dg/line_length_2.f90 new file mode 100644 index 00000000000..e1ab7220d03 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/line_length_2.f90 @@ -0,0 +1,8 @@ +! Testcase for -ffree-line-length-none +! See PR fortran/21302 +! { dg-do compile } +! { dg-options "-ffree-line-length-none" } +program two + if (abs(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).gt.999.d0.or.abs(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb).gt.999.d0.or.abs(cccccccccccccccccccc).gt.999.d0) THEN + endif +end program two diff --git a/gcc/testsuite/gfortran.dg/open_access_1.f90 b/gcc/testsuite/gfortran.dg/open_access_1.f90 new file mode 100644 index 00000000000..95466177f41 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/open_access_1.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } + + real :: a + a = 6.0 + open (unit = 6, file = 'foo', access = a) ! { dg-error "must be of type CHARACTER" } +end diff --git a/gcc/testsuite/gfortran.dg/pr24489.f90 b/gcc/testsuite/gfortran.dg/pr24489.f90 deleted file mode 100644 index f3327550297..00000000000 --- a/gcc/testsuite/gfortran.dg/pr24489.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! { dg-do run } -! PR24489 Assure that read does not go past the end of record. The width of -! the format specifier is 8, but the internal unit record length is 4 so only -! the first 4 characters should be read. -! Contributed by Jerry DeLisle <jvdelisle@verizon.net>. -program pr24489 - character*4, dimension(8) :: abuf = (/"0123","4567","89AB","CDEF", & - "0123","4567","89AB","CDEF"/) - character*4, dimension(2,4) :: buf - character*8 :: a - equivalence (buf,abuf) - read(buf, '(a8)') a - if (a.ne.'0123') call abort() -end program pr24489 diff --git a/gcc/testsuite/gfortran.dg/pr24584.f90 b/gcc/testsuite/gfortran.dg/pr24584.f90 deleted file mode 100644 index 12e72ae7e4d..00000000000 --- a/gcc/testsuite/gfortran.dg/pr24584.f90 +++ /dev/null @@ -1,17 +0,0 @@ -! pr24584, segfault on namelist reading an empty string -! Contributed by Jerry DeLisle <jvdelisle@verizon.net> - implicit none - character*20 temp - character(len=10) var - namelist /input/ var - var = 'Howdy' - open(unit=7, status="scratch") - temp = ' var=''''' ! var='' in the file - write(7,'(A6)') '&INPUT' - write(7,'(A10)') temp - write(7,'(A1)') '/' - rewind(7) - read(7,NML=input) - close(7) - if (var.ne.'') call abort - end diff --git a/gcc/testsuite/lib/gcov.exp b/gcc/testsuite/lib/gcov.exp index 9488db34f87..1da53ad52bc 100644 --- a/gcc/testsuite/lib/gcov.exp +++ b/gcc/testsuite/lib/gcov.exp @@ -27,7 +27,8 @@ global GCOV proc clean-gcov { testcase } { set basename [file tail $testcase] set base [file rootname $basename] - remote_file host delete $base.gcno $base.gcda $basename.gcov + remote_file host delete $base.gcno $base.gcda \ + $basename.gcov $base.h.gcov } # diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index b595149c06b..4f77f85135b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -183,7 +183,7 @@ proc check_test_flags { args } { proc dg-skip-if { args } { set args [lreplace $args 0 0] - set selector "target [join [lindex $args 1]]" + set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { # The target list matched; now check the flags. The DejaGnu proc # check_conditional_xfail will look at the options in compiler_flags, @@ -223,7 +223,7 @@ proc dg-xfail-if { args } { } set args [lreplace $args 0 0] - set selector "target [join [lindex $args 1]]" + set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data set compiler_conditional_xfail_data [lreplace $args 1 1 "*-*-*"] diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index bb6352f7c89..d2400956acc 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -384,6 +384,84 @@ proc check_effective_target_pcc_bitfield_type_matters { } { return $et_pcc_bitfield_type_matters_saved } +# Return 1 if thread local storage (TLS) is supported, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_tls {} { + global et_tls_saved + + if [info exists et_tls_saved] { + verbose "check_effective_target_tls: using cached result" 2 + } else { + set et_tls_saved 1 + + set src tls[pid].c + set asm tls[pid].S + verbose "check_effective_target_tls: compiling testfile $src" 2 + set f [open $src "w"] + # Compile a small test program. + puts $f "__thread int i;\n" + close $f + + # Test for thread-local data supported by the platform. + set comp_output \ + [target_compile $src $asm assembly ""] + file delete $src + if { [string match "*not supported*" $comp_output] } { + set et_tls_saved 0 + } + remove-build-file $asm + } + verbose "check_effective_target_tls: returning $et_tls_saved" 2 + return $et_tls_saved +} + +# Return 1 if TLS executables can run correctly, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_tls_runtime {} { + global et_tls_runtime_saved + + if [info exists et_tls_runtime_saved] { + verbose "check_effective_target_tls_runtime: using cached result" 2 + } else { + set et_tls_runtime_saved 0 + + set src tls_runtime[pid].c + set exe tls_runtime[pid].x + verbose "check_effective_target_tls_runtime: compiling testfile $src" 2 + set f [open $src "w"] + # Compile a small test program. + puts $f "__thread int thr = 0;\n" + puts $f "int main(void)\n {\n return thr;\n}" + close $f + + set comp_output \ + [target_compile $src $exe executable ""] + file delete $src + + if [string match "" $comp_output] then { + # No error messages, everything is OK. + + set result [remote_load target "./$exe" "" ""] + set status [lindex $result 0] + remote_file build delete $exe + + verbose "check_effective_target_tls_runtime status is <$status>" 2 + + if { $status == "pass" } { + set et_tls_runtime_saved 1 + } + + verbose "check_effective_target_tls_runtime: returning $et_tls_runtime_saved" 2 + } + } + + return $et_tls_runtime_saved +} + # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors # emitted, 0 otherwise. Whether a shared library can actually be built is # out of scope for this test. diff --git a/gcc/testsuite/treelang/ChangeLog b/gcc/testsuite/treelang/ChangeLog index 1eb4cea362b..e4ff2c66ffe 100644 --- a/gcc/testsuite/treelang/ChangeLog +++ b/gcc/testsuite/treelang/ChangeLog @@ -37,9 +37,9 @@ 2005-02-24 James A. Morrison <phython@gcc.gnu.org> PR other/19896 - * execute/execute.exp: New file. - * execute/funccall.tree, execute/funccall-2.tree, execute/initial.tree, - execute/main.tree, execute/static.tree: New tests. + * execute/execute.exp: New file. + * execute/funccall.tree, execute/funccall-2.tree, execute/initial.tree, + execute/main.tree, execute/static.tree: New tests. 2005-02-24 James A. Morrison <phython@gcc.gnu.org> @@ -64,9 +64,9 @@ 2004-01-18 James A. Morrison <ja2morri@uwaterloo.ca> - * compile/compile.exp: New File. - * compile/tabs.tree: Test whether the front end - compiles code with tabs in it. + * compile/compile.exp: New File. + * compile/tabs.tree: Test whether the front end + compiles code with tabs in it. 2003-02-25 Tim Josling <tej@melbpc.org.au> @@ -86,7 +86,7 @@ Remove duplicate call to layout_decl 2001-12-02 Tim Josling <tej@melbpc.org.au> - + * Make-lang.in Ensure directory is built during install (installdirs dependency) @@ -98,11 +98,11 @@ Work around poisoned malloc (undef IN_GCC) * tree1.c - New front end interface. + New front end interface. (top level) New structure lang_hooks. - (tree_post_options) Remove. + (tree_post_options) Remove. errorcount now a macro so do not define it. - current_nesting_level => work_nesting_level due to clash. + current_nesting_level => work_nesting_level due to clash. * treelang.h errorcount now a macro so do not reference it. @@ -114,11 +114,11 @@ 2001-06-11 Tim Josling <tej@melbpc.org.au> - * treelang.exp (global) remove COBOL specific code. + * treelang.exp (global) remove COBOL specific code. 2001-05-24 Tim Josling <tej@melbpc.org.au> - Created this directory and its tests. All derived from the cobol + Created this directory and its tests. All derived from the cobol test swamp which was also all written by me. - + |