diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
125 files changed, 312 insertions, 2695 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c index 7e43c8ad467..7a02b685c4a 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20000211-3.c +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-3.c @@ -3,7 +3,7 @@ void f_clos(int x) { switch(x) { default: - mumble: + mumble:; } } diff --git a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c index fda44b657cc..d2087796a84 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20000518-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20000518-1.c @@ -6,7 +6,7 @@ extern __inline__ void test() callit1(&&l1); -l1: +l1:; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c index cce8047ae8a..6e513c9563f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c @@ -1,3 +1,5 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ typedef struct _foo foo; extern foo bar; struct _foo { diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c index a23e56bd34b..1448215c578 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c @@ -1,3 +1,5 @@ +/* This does not work on NetWare, which has a default of 1-byte alignment. */ +/* { dg-xfail-if "" { "*-*-netware*" } { "*" } { "" } } */ extern struct foo bar; struct foo { int a; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c b/gcc/testsuite/gcc.c-torture/compile/20010516-1.c deleted file mode 100644 index 7732812cfb1..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20010516-1.c +++ /dev/null @@ -1,5 +0,0 @@ -foo() -{ - char d; - asm volatile ( "" :: "m"(&d)); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c index 4ab40d8e226..0a1b284b447 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010518-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-1.c @@ -25,7 +25,7 @@ enum rtx_code UNKNOWN, NIL, REG, - LAST_AND_UNUSED_RTX_CODE + LAST_AND_UNUSED_RTX_CODE = 256 }; typedef struct diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c index 488a1b403d3..ef24e1cf139 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c @@ -1,5 +1,5 @@ /* The array is too big. */ -/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" } { "" } } */ +/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ /* { dg-do assemble { xfail m6811-*-* m6812-*-* } } */ /* PR c/6957 diff --git a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c index 31398ea3d45..092809b769c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20020910-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20020910-1.c @@ -1,3 +1,8 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else unsigned int x0 = 0; typedef struct { @@ -11,4 +16,4 @@ static void foo (void) { yy.field1 = (unsigned int ) (&x0); } - +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c index c421639035a..01b6e4ed7aa 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20021108-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20021108-1.c @@ -3,5 +3,5 @@ main() { l1: return &&l1-&&l2; -l2: +l2:; } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-1.c b/gcc/testsuite/gcc.c-torture/compile/20021123-1.c deleted file mode 100644 index dd2aa7e09dd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* PR c/8439 */ -/* Verify that GCC properly handles null increments. */ - -struct empty { -}; - -void foo(struct empty *p) -{ - p++; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-2.c b/gcc/testsuite/gcc.c-torture/compile/20021123-2.c deleted file mode 100644 index 423f8ec1964..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-2.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int inline bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-3.c b/gcc/testsuite/gcc.c-torture/compile/20021123-3.c deleted file mode 100644 index 51f0e257dfd..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-3.c +++ /dev/null @@ -1,9 +0,0 @@ -/* PR c/8518 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC doesn't get confused by the - redefinition of an extern inline function. */ - -extern int inline foo () { return 0; } -extern int inline bar () { return 0; } -static int bar () { return foo(); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-4.c b/gcc/testsuite/gcc.c-torture/compile/20021123-4.c deleted file mode 100644 index d4306b89b99..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/20021123-4.c +++ /dev/null @@ -1,11 +0,0 @@ -/* PR c/8588 */ -/* Contributed by Volker Reichelt. */ - -/* Verify that GCC converts integer constants - in shift operations. */ - -void foo() -{ - unsigned int i, j; - j = (i >> 0xf0); -} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c index 2e61f1fa3ff..f84e606c045 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c @@ -1,58 +1,30 @@ -/* PR optimization/10024 */ -extern int *allegro_errno; -typedef long fixed; -extern inline int -fixfloor (fixed x) -{ - if (x >= 0) - return (x >> 16); - else - return ~((~x) >> 16); -} -extern inline int -fixtoi (fixed x) -{ - return fixfloor (x) + ((x & 0x8000) >> 15); -} -extern inline fixed -ftofix (double x) -{ - if (x > 32767.0) - { - *allegro_errno = 34; - return 0x7FFFFFFF; - } - if (x < -32767.0) - { - *allegro_errno = 34; - return -0x7FFFFFFF; - } - return (long) (x * 65536.0 + (x < 0 ? -0.5 : 0.5)); -} -extern inline double -fixtof (fixed x) -{ - return (double) x / 65536.0; -} -extern inline fixed -fixdiv (fixed x, fixed y) +/* When compiled with -pedantic, this program will cause an ICE when the + constant propagator tries to set the value of *str to UNDEFINED. + + This happens because *str is erroneously considered as a store alias. + The aliasing code is then making *str an alias leader for its alias set + and when the PHI node at the end of the while() is visited the first + time, CCP will try to assign it a value of UNDEFINED, but the default + value for *str is a constant. */ +typedef unsigned int size_t; +size_t strlength (const char * const); +char foo(); + +static const char * const str = "mingo"; + +bar() { - if (y == 0) + size_t c; + char *x; + + c = strlength (str); + while (c < 10) { - *allegro_errno = 34; - return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF; + if (c > 5) + *x = foo (); + if (*x < 'a') + break; } - else - return ftofix (fixtof (x) / fixtof (y)); -} -extern inline fixed -itofix (int x) -{ - return x << 16; -} -int -foo (int n) -{ - return fixtoi (fixdiv (itofix (512), itofix (n))); + return *x == '3'; } diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-1.c b/gcc/testsuite/gcc.c-torture/compile/920625-1.c index 137e0dc1f17..6a52b029bad 100644 --- a/gcc/testsuite/gcc.c-torture/compile/920625-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/920625-1.c @@ -11,7 +11,11 @@ (p7) mov r14 = r0 that appears to be a WAW violation. */ -/* { dg-xfail-if "missing .pred.rel.mutex directive" "ia64-*-*" { "-O1" "-O2" "-O3" "-Os" } { "" } } */ + +/* { dg-prune-output "Assembler messages" } */ +/* { dg-prune-output "violate\[^\n\]*dependency" } */ +/* { dg-prune-output "first path encountering" } */ +/* { dg-prune-output "location of the conflicting" } */ typedef unsigned long int unsigned_word; typedef signed long int signed_word; diff --git a/gcc/testsuite/gcc.c-torture/compile/920625-2.c b/gcc/testsuite/gcc.c-torture/compile/920625-2.c index 1466285f88e..291e80d0210 100644 --- a/gcc/testsuite/gcc.c-torture/compile/920625-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/920625-2.c @@ -23,7 +23,7 @@ trashQueryResult(Widget w, Boolean delete, caddr_t call_data) extern Cursor busy, left_ptr; extern String cwd; - static void freeReturnStruct(void); + extern void freeReturnStruct(void); String rmstring; int status; XedwListReturnStruct *tmp; @@ -58,7 +58,7 @@ copyQueryResult(Widget w, Boolean copy, caddr_t call_data) extern void destroy_button_dialog(); extern void changestate(Boolean); extern Cursor busy, left_ptr; - static void freeReturnStruct(void); + extern void freeReturnStruct(void); int execute(String, String, String, Boolean); extern String cwd; String copystring; diff --git a/gcc/testsuite/gcc.c-torture/compile/930217-1.c b/gcc/testsuite/gcc.c-torture/compile/930217-1.c index 70f4a4897c4..0f64a040712 100644 --- a/gcc/testsuite/gcc.c-torture/compile/930217-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/930217-1.c @@ -1,3 +1,8 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else double g (); typedef union { struct { @@ -12,3 +17,4 @@ f(x, n) ((s *)&x)->u.e -= n; x = g((double)x, -n); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/930513-1.c b/gcc/testsuite/gcc.c-torture/compile/930513-1.c index 2e106ae43a9..463fd89b401 100644 --- a/gcc/testsuite/gcc.c-torture/compile/930513-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/930513-1.c @@ -1,3 +1,8 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int a; +#else struct s { int f1 : 26; int f2 : 8; @@ -7,3 +12,4 @@ f (struct s *x) { return x->f2++ == 0; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/950922-1.c b/gcc/testsuite/gcc.c-torture/compile/950922-1.c index 73574f33e68..73c52f7740a 100644 --- a/gcc/testsuite/gcc.c-torture/compile/950922-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/950922-1.c @@ -40,7 +40,7 @@ f (int ch, char *fp, char *ap) nosign: if (_uquad != 0 || prec != 0); break; - default: + default:; } if ((f & 0x100) == 0) { } else { @@ -64,5 +64,5 @@ f (int ch, char *fp, char *ap) } } - error: + error:; } diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.c b/gcc/testsuite/gcc.c-torture/compile/961203-1.c index 1d879292e51..98908584333 100644 --- a/gcc/testsuite/gcc.c-torture/compile/961203-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.c @@ -1,8 +1,8 @@ /* The structure is too large for the xstormy16 - won't fit in 16 bits. */ -/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" } { "" } } */ -/* { dg-do assemble { xfail xstormy16-*-* m6811-*-* m6812-*-* } } */ +/* { dg-do assemble } */ +#if __INT_MAX__ >= 2147483647L struct s { char a[0x32100000]; int x:30, y:30; @@ -17,3 +17,6 @@ main () if (p->x == p->y) exit (1); } +#else +int g; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.c b/gcc/testsuite/gcc.c-torture/compile/980506-1.c index fd3496af309..9bc2d8afc3e 100644 --- a/gcc/testsuite/gcc.c-torture/compile/980506-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.c @@ -1,5 +1,5 @@ /* The arrays are too large for the xstormy16 - won't fit in 16 bits. */ -/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" } { "" } } */ +/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ /* { dg-do assemble { xfail xstormy16-*-* m6811-*-* m6812-*-* } } */ unsigned char TIFFFax2DMode[20][256]; diff --git a/gcc/testsuite/gcc.c-torture/compile/981006-1.c b/gcc/testsuite/gcc.c-torture/compile/981006-1.c index d71637328db..718fa881af5 100644 --- a/gcc/testsuite/gcc.c-torture/compile/981006-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/981006-1.c @@ -6,7 +6,7 @@ /* { dg-do assemble } */ /* For MIPS at least, pic is needed to trigger the problem. */ /* { dg-options "-w -Wuninitialized -Werror -fpic" } */ -/* { dg-options "-w -Wuninitialized -Werror" { target rs6000-*-aix* powerpc*-*-aix* arm*-*-* xscale*-*-* strongarm*-*-* fr30-*-* sh-*-hms sh-*-coff h8300*-*-* mn10200*-*-* cris-*-elf* cris-*-aout* mmix-*-* } } */ +/* { dg-options "-w -Wuninitialized -Werror" { target rs6000-*-aix* powerpc*-*-aix* arm*-*-* xscale*-*-* strongarm*-*-* fr30-*-* sh-*-hms sh-*-coff h8300*-*-* cris-*-elf* cris-*-aout* mmix-*-* } } */ int foo (int a, int b) { diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.c b/gcc/testsuite/gcc.c-torture/compile/981022-1.c deleted file mode 100644 index 46369fc8181..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/981022-1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* This tests a combination of two gcc extensions. Omitting the middle - operand of ?: and using ?: as an lvalue. */ -int x, y; - -int main () -{ - (x ?: y) = 0; /* { dg-bogus "lvalue" "" { xfail *-*-* } } */ - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c index d0939f62eaf..b6289480749 100644 --- a/gcc/testsuite/gcc.c-torture/compile/981223-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.c @@ -1,11 +1,11 @@ /* The problem on IA-64 is that the assembler emits Warning: Additional NOP may be necessary to workaround Itanium - processor A/B step errata + processor A/B step errata */ + +/* { dg-prune-output "Assembler messages" } */ +/* { dg-prune-output "Additional NOP may be necessary" } */ - This can be fixed by adding "-mb-step" to the command line, which - does in fact add the extra nop. */ -/* { dg-options "-w -mb-step" { target ia64-*-* } } */ __complex__ float func (__complex__ float x) diff --git a/gcc/testsuite/gcc.c-torture/compile/dll.x b/gcc/testsuite/gcc.c-torture/compile/dll.x deleted file mode 100644 index 63a1e180e2c..00000000000 --- a/gcc/testsuite/gcc.c-torture/compile/dll.x +++ /dev/null @@ -1,20 +0,0 @@ -# This test examines the attribute support for DLLs. -# Only COFF/PE formats support DLLs, (plus, as a special case -# the mcore-elf toolchain), so the code here tries to determine -# the file format and decide whether the test should be marked -# as unsupported. - -set torture_eval_before_compile { - - if ![istarget "mcore-*-elf"] { - - set objformat [gcc_target_object_format] - - if { $objformat != "pe" } { - unsupported "dll.c" - return 1 - } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17529.c b/gcc/testsuite/gcc.c-torture/compile/pr17529.c index 63a96a1c363..77c7a06ddc7 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr17529.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr17529.c @@ -1,3 +1,4 @@ +/* { dg-xfail-if "PR middle-end/17529" { "*-*-*" } { "*" } { "" } } */ static inline void bar (const int * const x) @@ -5,7 +6,7 @@ bar (const int * const x) __asm__ __volatile__ (""::"m" (*x)); } -static const int y[1]; +static const int y[]; void foo (void) diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-1.c b/gcc/testsuite/gcc.c-torture/compile/simd-1.c index c113bd4fa2d..6a07bbb6ac6 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-1.c @@ -1,4 +1,4 @@ -typedef int v2si __attribute__ ((mode(V2SI))); +typedef int v2si __attribute__ ((vector_size (8))); typedef unsigned di __attribute__ ((mode(DI))); void foo(unsigned long); void bar() { diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-2.c b/gcc/testsuite/gcc.c-torture/compile/simd-2.c index 694e94f0105..480c712c023 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-2.c @@ -1,4 +1,4 @@ -typedef float floatvect2 __attribute__((mode(V2SF))); +typedef float floatvect2 __attribute__((vector_size (8))); typedef union { diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-3.c b/gcc/testsuite/gcc.c-torture/compile/simd-3.c index f7dc54ebf8b..42a38ae56e6 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-3.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-3.c @@ -3,7 +3,7 @@ /* If double is not wider than float, we probably don't have DFmode, or at least it's not as wide as double. */ #if DBL_MANT_DIG > FLT_MANT_DIG -typedef float floatvect2 __attribute__((mode(V2DF))); +typedef double floatvect2 __attribute__((vector_size (16))); typedef union { diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-4.c b/gcc/testsuite/gcc.c-torture/compile/simd-4.c index 6ede943c47d..6329fc0968f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-4.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-4.c @@ -1,4 +1,4 @@ -typedef float floatvect2 __attribute__((mode(V4SF))); +typedef float floatvect2 __attribute__((vector_size (16))); typedef union { diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.c b/gcc/testsuite/gcc.c-torture/compile/simd-5.c index d82b504a505..1575dc1a8d4 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-5.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-5.c @@ -1,7 +1,7 @@ -/* On SPARC64/SPARC-V9 it fails, except with -m32. */ -/* { dg-xfail-if "PR target/9200" { "sparc64-*-*" "sparcv9-*-*" } { "*" } { "-m32" } } */ -/* On regular SPARC it doesn't fail, except with -m64. */ -/* { dg-xfail-if "PR target/9200" { "sparc-*-*" } { "-m64" } { "" } } */ +/* On SPARC64/SPARC-V9 it fails at -O0 and -O1, except with -m32. */ +/* { dg-xfail-if "PR target/9200" { "sparc64-*-*" "sparcv9-*-*" } { "-O0" "-O1" } { "-m32" } } */ +/* On regular SPARC it doesn't fail, except with -m64 at -O0 and -O1. */ +/* { dg-xfail-if "PR target/9200" { "sparc-*-*" } { "-m64 -O0" "-m64 -O1" } { "" } } */ #define vector64 __attribute__((vector_size(8))) diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-6.c b/gcc/testsuite/gcc.c-torture/compile/simd-6.c index 9106a73363d..7998e152f89 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-6.c +++ b/gcc/testsuite/gcc.c-torture/compile/simd-6.c @@ -1,3 +1,3 @@ -typedef int __attribute__((mode(V2SI))) vec; +typedef int __attribute__((vector_size (8))) vec; vec a[] = {(vec) {1, 2}, {3, 4}}; diff --git a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c index 9c9f69baf04..e94a2c8e6da 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c @@ -1,5 +1,10 @@ +/* It is not clear whether this test is conforming. See DR#236 + http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_236.htm. However, + there seems to be consensus that the presence of a union to aggregate + struct s1 and struct s2 should make it conforming. */ struct s1 { double d; }; struct s2 { double d; }; +union u { struct s1 x; struct s2 y; }; double f(struct s1 *a, struct s2 *b) { @@ -9,9 +14,9 @@ double f(struct s1 *a, struct s2 *b) int main() { - struct s1 a; - a.d = 0.0; - if (f (&a, (struct s2 *)&a) != 2.0) + union u a; + a.x.d = 0.0; + if (f (&a.x, &a.y) != 2.0) abort (); return 0; } diff --git a/gcc/testsuite/gcc.c-torture/execute/20010605-1.c b/gcc/testsuite/gcc.c-torture/execute/20010605-1.c index 4bf230ba54a..c777af5bdc4 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20010605-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20010605-1.c @@ -2,7 +2,7 @@ int main () { int v = 42; - static inline int fff (int x) + inline int fff (int x) { return x*10; } diff --git a/gcc/testsuite/gcc.c-torture/execute/20020227-1.x b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x index 72adedff865..4e7194792cd 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20020227-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x @@ -24,8 +24,8 @@ if { [istarget "sparc64-*-*"] || [istarget "sparcv9-*-*"] } { { "-O0" "-O1" } } } -} elseif { [istarget "powerpc64-*-*"] } { - # PowerPC-64 doesn't fail at any optimization level. +} elseif { [istarget "powerpc64-*-*"] || [istarget "x86_64-*-*"] } { + # PowerPC-64 and x86_64 do not fail at any optimization level. } elseif { [istarget "*64*-*-*"] || [istarget "alpha*-*-*"] || [istarget "mmix-*-*"] || [istarget "mips*-*-irix6*"] } { # Other 64-bit targets fail at all optimization levels. diff --git a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x index 58e311c0d3c..7afd9e44879 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x @@ -11,12 +11,25 @@ # and can make the optimization. # Don't XFAIL at -O0, that should never fail. +if { [istarget "sparc*-*-*"] } { + set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "PR opt/10348" \ + { "*-*-*" } \ + { "-fpic" "-fPIC" } \ + { "-O0" } + } + } + return 0 +} + set torture_eval_before_compile { global compiler_conditional_xfail_data set compiler_conditional_xfail_data { "This test fails to optimize completely on certain platforms." \ { "xtensa-*-*" "sh-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" \ - "h8300*-*-*" "x86_64-*-*" "cris-*-*" } \ + "h8300*-*-*" "cris-*-*" "frv-*-*" "powerpc-*-*spe" } \ { "*" } \ { "-O0" } } diff --git a/gcc/testsuite/gcc.c-torture/execute/20031003-1.c b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c index b60711f732b..5d39d799e50 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20031003-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20031003-1.c @@ -1,5 +1,7 @@ /* PR optimization/9325 */ +#include <limits.h> + extern void abort (void); int f1() @@ -12,30 +14,13 @@ int f2() return (int)(float)(2147483647); } -int f3() -{ - float a = 2147483648.0f; - return (int)a; -} - -int f4() -{ - int a = 2147483647; - float b = (float)a; - return (int)b; -} - int main() { +#if INT_MAX == 2147483647 if (f1() != 2147483647) abort (); if (f2() != 2147483647) abort (); -#ifdef __OPTIMIZE__ - if (f3() != 2147483647) - abort (); - if (f4() != 2147483647) - abort (); #endif return 0; } diff --git a/gcc/testsuite/gcc.c-torture/execute/920428-2.x b/gcc/testsuite/gcc.c-torture/execute/920428-2.x deleted file mode 100644 index c7d9f030049..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/920428-2.x +++ /dev/null @@ -1,6 +0,0 @@ -# This doesn't work on sparc's with -mflat. - -if { [istarget "sparc-*-*"] && [string match "*mflat*" $CFLAGS] } { - set torture_execute_xfail "sparc-*-*" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-7.x b/gcc/testsuite/gcc.c-torture/execute/920501-7.x deleted file mode 100644 index c7d9f030049..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/920501-7.x +++ /dev/null @@ -1,6 +0,0 @@ -# This doesn't work on sparc's with -mflat. - -if { [istarget "sparc-*-*"] && [string match "*mflat*" $CFLAGS] } { - set torture_execute_xfail "sparc-*-*" -} -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/920908-2.c b/gcc/testsuite/gcc.c-torture/execute/920908-2.c index 66a6d86a7e7..31c1ae0769c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/920908-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/920908-2.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else /* CONF:m68k-sun-sunos4.1.1 OPTIONS:-O @@ -21,3 +30,4 @@ t.c=0xffff11; if(f(t)!=0x11)abort(); exit(0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/921204-1.c b/gcc/testsuite/gcc.c-torture/execute/921204-1.c index 9e4f4a6bae7..a7bba830a34 100644 --- a/gcc/testsuite/gcc.c-torture/execute/921204-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/921204-1.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else typedef struct { unsigned b0:1, f1:17, b18:1, b19:1, b20:1, f2:11; } bf; @@ -34,3 +43,4 @@ main() abort(); exit(0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/930529-1.x b/gcc/testsuite/gcc.c-torture/execute/930529-1.x index a44f482c22f..fb86979f7c1 100644 --- a/gcc/testsuite/gcc.c-torture/execute/930529-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/930529-1.x @@ -4,15 +4,20 @@ # The problem is that the multiplication was unsigned SImode, and the # induction variable is DImode, and we lose the truncation that # should have happened. +# +# On tree-ssa branch, the loop problem is still extant, but the +# gimple-level optimization makes it easy for the tree-rtl expanders +# to see that the comparisons are always true, and so the loop code +# is never exercized. -set torture_eval_before_execute { - - set compiler_conditional_xfail_data { - "division by a constant conflicts with strength reduction" \ - "alpha*-*-*" \ - { "-O3" } \ - { "" } - } -} +# set torture_eval_before_execute { +# +# set compiler_conditional_xfail_data { +# "division by a constant conflicts with strength reduction" \ +# "alpha*-*-*" \ +# { "-O3" } \ +# { "" } +# } +# } return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/930621-1.c b/gcc/testsuite/gcc.c-torture/execute/930621-1.c index 6131301df2f..4bb7cdbe076 100644 --- a/gcc/testsuite/gcc.c-torture/execute/930621-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/930621-1.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else f () { struct { @@ -17,3 +26,4 @@ main () abort (); exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/930630-1.c b/gcc/testsuite/gcc.c-torture/execute/930630-1.c index 4befa835d0d..38ad1fdfd7b 100644 --- a/gcc/testsuite/gcc.c-torture/execute/930630-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/930630-1.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else main () { struct @@ -17,3 +26,4 @@ f (x) if (x != 7) abort (); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/931031-1.c b/gcc/testsuite/gcc.c-torture/execute/931031-1.c index 761989040f4..e9ce337955d 100644 --- a/gcc/testsuite/gcc.c-torture/execute/931031-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/931031-1.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else struct foo { unsigned y:1; @@ -22,3 +31,4 @@ main () abort (); exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/960416-1.x b/gcc/testsuite/gcc.c-torture/execute/960416-1.x deleted file mode 100644 index ca8e06c4077..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/960416-1.x +++ /dev/null @@ -1,5 +0,0 @@ -if { [istarget "h8300*-*-*"] } { - return 1 -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/980602-2.c b/gcc/testsuite/gcc.c-torture/execute/980602-2.c index 8ef23222d62..972553ed584 100644 --- a/gcc/testsuite/gcc.c-torture/execute/980602-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/980602-2.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else struct { unsigned bit : 30; } t; @@ -9,3 +18,4 @@ int main() else abort (); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/990208-1.x b/gcc/testsuite/gcc.c-torture/execute/990208-1.x deleted file mode 100644 index c1710099151..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/990208-1.x +++ /dev/null @@ -1,14 +0,0 @@ -# Doesn't work at -O3 because of ifcvt.c optimizations which -# cause the 2 inlined labels to be at the same location. - -set torture_eval_before_execute { - - set compiler_conditional_xfail_data { - "ifcvt transforms 2 inlined labels to the same address" \ - { "ia64-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" } \ - { "-O3" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/991216-3.c b/gcc/testsuite/gcc.c-torture/execute/991216-3.c deleted file mode 100644 index 948b35f9795..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/991216-3.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <stdarg.h> - -#define VALUE 0x123456789abcdefLL -#define AFTER 0x55 - -void -test (int n, ...) -{ - va_list ap; - int i; - - va_start (ap, n); - - for (i = 2; i <= n; i++) - { - if (va_arg (ap, int) != i) - abort (); - } - - if (va_arg (ap, long long) != VALUE) - abort (); - - if (va_arg (ap, int) != AFTER) - abort (); - - va_end (ap); -} - -int -main () -{ - test (1, VALUE, AFTER); - test (2, 2, VALUE, AFTER); - test (3, 2, 3, VALUE, AFTER); - test (4, 2, 3, 4, VALUE, AFTER); - test (5, 2, 3, 4, 5, VALUE, AFTER); - test (6, 2, 3, 4, 5, 6, VALUE, AFTER); - test (7, 2, 3, 4, 5, 6, 7, VALUE, AFTER); - test (8, 2, 3, 4, 5, 6, 7, 8, VALUE, AFTER); - exit (0); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-1.x b/gcc/testsuite/gcc.c-torture/execute/bitfld-1.x deleted file mode 100644 index 2f397b96e51..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/bitfld-1.x +++ /dev/null @@ -1,2 +0,0 @@ -set torture_execute_xfail "*-*-*" -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-abs-1.c b/gcc/testsuite/gcc.c-torture/execute/builtin-abs-1.c deleted file mode 100644 index 8a34353763d..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtin-abs-1.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Test for builtin abs, labs, llabs, imaxabs. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ - -/* These next definitions are kludges. When GCC has a <stdint.h> it - should be used. -*/ -#include <limits.h> -#if INT_MAX == __LONG_LONG_MAX__ -typedef int intmax_t; -#define INTMAX_MAX INT_MAX -#elif LONG_MAX == __LONG_LONG_MAX__ -typedef long intmax_t; -#define INTMAX_MAX LONG_MAX -#else -typedef long long intmax_t; -#define INTMAX_MAX __LONG_LONG_MAX__ -#endif - -extern int abs (int); -extern long labs (long); -extern long long llabs (long long); -extern intmax_t imaxabs (intmax_t); -extern void abort (void); -extern void exit (int); - -extern void link_failure (void); - -int -main (void) -{ - /* For each type, test both runtime and compile time (constant folding) - optimization. */ - volatile int i0 = 0, i1 = 1, im1 = -1, imin = -INT_MAX, imax = INT_MAX; - volatile long l0 = 0L, l1 = 1L, lm1 = -1L, lmin = -LONG_MAX, lmax = LONG_MAX; - volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL; - volatile long long llmin = -__LONG_LONG_MAX__, llmax = __LONG_LONG_MAX__; - volatile intmax_t imax0 = 0, imax1 = 1, imaxm1 = -1; - volatile intmax_t imaxmin = -INTMAX_MAX, imaxmax = INTMAX_MAX; - if (abs (i0) != 0) - abort (); - if (abs (0) != 0) - link_failure (); - if (abs (i1) != 1) - abort (); - if (abs (1) != 1) - link_failure (); - if (abs (im1) != 1) - abort (); - if (abs (-1) != 1) - link_failure (); - if (abs (imin) != INT_MAX) - abort (); - if (abs (-INT_MAX) != INT_MAX) - link_failure (); - if (abs (imax) != INT_MAX) - abort (); - if (abs (INT_MAX) != INT_MAX) - link_failure (); - if (labs (l0) != 0L) - abort (); - if (labs (0L) != 0L) - link_failure (); - if (labs (l1) != 1L) - abort (); - if (labs (1L) != 1L) - link_failure (); - if (labs (lm1) != 1L) - abort (); - if (labs (-1L) != 1L) - link_failure (); - if (labs (lmin) != LONG_MAX) - abort (); - if (labs (-LONG_MAX) != LONG_MAX) - link_failure (); - if (labs (lmax) != LONG_MAX) - abort (); - if (labs (LONG_MAX) != LONG_MAX) - link_failure (); - if (llabs (ll0) != 0LL) - abort (); - if (llabs (0LL) != 0LL) - link_failure (); - if (llabs (ll1) != 1LL) - abort (); - if (llabs (1LL) != 1LL) - link_failure (); - if (llabs (llm1) != 1LL) - abort (); - if (llabs (-1LL) != 1LL) - link_failure (); - if (llabs (llmin) != __LONG_LONG_MAX__) - abort (); - if (llabs (-__LONG_LONG_MAX__) != __LONG_LONG_MAX__) - link_failure (); - if (llabs (llmax) != __LONG_LONG_MAX__) - abort (); - if (llabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__) - link_failure (); - if (imaxabs (imax0) != 0) - abort (); - if (imaxabs (0) != 0) - link_failure (); - if (imaxabs (imax1) != 1) - abort (); - if (imaxabs (1) != 1) - link_failure (); - if (imaxabs (imaxm1) != 1) - abort (); - if (imaxabs (-1) != 1) - link_failure (); - if (imaxabs (imaxmin) != INTMAX_MAX) - abort (); - if (imaxabs (-INTMAX_MAX) != INTMAX_MAX) - link_failure (); - if (imaxabs (imaxmax) != INTMAX_MAX) - abort (); - if (imaxabs (INTMAX_MAX) != INTMAX_MAX) - link_failure (); - exit (0); -} - -/* All the above cases should have been optimized to something else, - even if not optimizing (unless -fno-builtin was specified). So any - remaining calls to the original functions should abort. */ - -static int -abs (int x) -{ - abort (); -} - -static long -labs (long x) -{ - abort (); -} - -static long long -llabs (long long x) -{ - abort (); -} - -static intmax_t -imaxabs (intmax_t x) -{ - abort (); -} - -/* When optimizing, all the constant cases should have been - constant folded, so no calls to link_failure should remain. In any case, - link_failure should not be called. */ - -#ifndef __OPTIMIZE__ -void -link_failure (void) -{ - abort (); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-abs-2.c b/gcc/testsuite/gcc.c-torture/execute/builtin-abs-2.c deleted file mode 100644 index b4e18796560..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtin-abs-2.c +++ /dev/null @@ -1,156 +0,0 @@ -/* Test for builtin abs, labs, llabs, imaxabs. Test for __builtin versions. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ - -/* These next definitions are kludges. When GCC has a <stdint.h> it - should be used. -*/ -#include <limits.h> -#if INT_MAX == __LONG_LONG_MAX__ -typedef int intmax_t; -#define INTMAX_MAX INT_MAX -#elif LONG_MAX == __LONG_LONG_MAX__ -typedef long intmax_t; -#define INTMAX_MAX LONG_MAX -#else -typedef long long intmax_t; -#define INTMAX_MAX __LONG_LONG_MAX__ -#endif - -extern void abort (void); -extern void exit (int); - -extern void link_failure (void); - -int -main (void) -{ - /* For each type, test both runtime and compile time (constant folding) - optimization. */ - volatile int i0 = 0, i1 = 1, im1 = -1, imin = -INT_MAX, imax = INT_MAX; - volatile long l0 = 0L, l1 = 1L, lm1 = -1L, lmin = -LONG_MAX, lmax = LONG_MAX; - volatile long long ll0 = 0LL, ll1 = 1LL, llm1 = -1LL; - volatile long long llmin = -__LONG_LONG_MAX__, llmax = __LONG_LONG_MAX__; - volatile intmax_t imax0 = 0, imax1 = 1, imaxm1 = -1; - volatile intmax_t imaxmin = -INTMAX_MAX, imaxmax = INTMAX_MAX; - if (__builtin_abs (i0) != 0) - abort (); - if (__builtin_abs (0) != 0) - link_failure (); - if (__builtin_abs (i1) != 1) - abort (); - if (__builtin_abs (1) != 1) - link_failure (); - if (__builtin_abs (im1) != 1) - abort (); - if (__builtin_abs (-1) != 1) - link_failure (); - if (__builtin_abs (imin) != INT_MAX) - abort (); - if (__builtin_abs (-INT_MAX) != INT_MAX) - link_failure (); - if (__builtin_abs (imax) != INT_MAX) - abort (); - if (__builtin_abs (INT_MAX) != INT_MAX) - link_failure (); - if (__builtin_labs (l0) != 0L) - abort (); - if (__builtin_labs (0L) != 0L) - link_failure (); - if (__builtin_labs (l1) != 1L) - abort (); - if (__builtin_labs (1L) != 1L) - link_failure (); - if (__builtin_labs (lm1) != 1L) - abort (); - if (__builtin_labs (-1L) != 1L) - link_failure (); - if (__builtin_labs (lmin) != LONG_MAX) - abort (); - if (__builtin_labs (-LONG_MAX) != LONG_MAX) - link_failure (); - if (__builtin_labs (lmax) != LONG_MAX) - abort (); - if (__builtin_labs (LONG_MAX) != LONG_MAX) - link_failure (); - if (__builtin_llabs (ll0) != 0LL) - abort (); - if (__builtin_llabs (0LL) != 0LL) - link_failure (); - if (__builtin_llabs (ll1) != 1LL) - abort (); - if (__builtin_llabs (1LL) != 1LL) - link_failure (); - if (__builtin_llabs (llm1) != 1LL) - abort (); - if (__builtin_llabs (-1LL) != 1LL) - link_failure (); - if (__builtin_llabs (llmin) != __LONG_LONG_MAX__) - abort (); - if (__builtin_llabs (-__LONG_LONG_MAX__) != __LONG_LONG_MAX__) - link_failure (); - if (__builtin_llabs (llmax) != __LONG_LONG_MAX__) - abort (); - if (__builtin_llabs (__LONG_LONG_MAX__) != __LONG_LONG_MAX__) - link_failure (); - if (__builtin_imaxabs (imax0) != 0) - abort (); - if (__builtin_imaxabs (0) != 0) - link_failure (); - if (__builtin_imaxabs (imax1) != 1) - abort (); - if (__builtin_imaxabs (1) != 1) - link_failure (); - if (__builtin_imaxabs (imaxm1) != 1) - abort (); - if (__builtin_imaxabs (-1) != 1) - link_failure (); - if (__builtin_imaxabs (imaxmin) != INTMAX_MAX) - abort (); - if (__builtin_imaxabs (-INTMAX_MAX) != INTMAX_MAX) - link_failure (); - if (__builtin_imaxabs (imaxmax) != INTMAX_MAX) - abort (); - if (__builtin_imaxabs (INTMAX_MAX) != INTMAX_MAX) - link_failure (); - exit (0); -} - -/* All the above cases should have been optimized to something else, - not converted to function calls. So any calls to the non-__builtin - functions should abort. */ - -static int -abs (int x) -{ - abort (); -} - -static long -labs (long x) -{ - abort (); -} - -static long long -llabs (long long x) -{ - abort (); -} - -static intmax_t -imaxabs (intmax_t x) -{ - abort (); -} - -/* When optimizing, all the constant cases should have been - constant folded, so no calls to link_failure should remain. In any case, - link_failure should not be called. */ - -#ifndef __OPTIMIZE__ -void -link_failure (void) -{ - abort (); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-complex-1.c b/gcc/testsuite/gcc.c-torture/execute/builtin-complex-1.c deleted file mode 100644 index 46ab7c51c0f..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtin-complex-1.c +++ /dev/null @@ -1,175 +0,0 @@ -/* Test for builtin conj, creal, cimag. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ - -extern float _Complex conjf (float _Complex); -extern double _Complex conj (double _Complex); -extern long double _Complex conjl (long double _Complex); - -extern float crealf (float _Complex); -extern double creal (double _Complex); -extern long double creall (long double _Complex); - -extern float cimagf (float _Complex); -extern double cimag (double _Complex); -extern long double cimagl (long double _Complex); - -extern void abort (void); -extern void exit (int); - -extern void link_failure (void); - -int -main (void) -{ - /* For each type, test both runtime and compile time (constant folding) - optimization. */ - volatile float _Complex fc = 1.0F + 2.0iF; - volatile double _Complex dc = 1.0 + 2.0i; - volatile long double _Complex ldc = 1.0L + 2.0iL; - /* Test floats. */ - if (conjf (fc) != 1.0F - 2.0iF) - abort (); - if (__builtin_conjf (fc) != 1.0F - 2.0iF) - abort (); - if (conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) - link_failure (); - if (__builtin_conjf (1.0F + 2.0iF) != 1.0F - 2.0iF) - link_failure (); - if (crealf (fc) != 1.0F) - abort (); - if (__builtin_crealf (fc) != 1.0F) - abort (); - if (crealf (1.0F + 2.0iF) != 1.0F) - link_failure (); - if (__builtin_crealf (1.0F + 2.0iF) != 1.0F) - link_failure (); - if (cimagf (fc) != 2.0F) - abort (); - if (__builtin_cimagf (fc) != 2.0F) - abort (); - if (cimagf (1.0F + 2.0iF) != 2.0F) - link_failure (); - if (__builtin_cimagf (1.0F + 2.0iF) != 2.0F) - link_failure (); - /* Test doubles. */ - if (conj (dc) != 1.0 - 2.0i) - abort (); - if (__builtin_conj (dc) != 1.0 - 2.0i) - abort (); - if (conj (1.0 + 2.0i) != 1.0 - 2.0i) - link_failure (); - if (__builtin_conj (1.0 + 2.0i) != 1.0 - 2.0i) - link_failure (); - if (creal (dc) != 1.0) - abort (); - if (__builtin_creal (dc) != 1.0) - abort (); - if (creal (1.0 + 2.0i) != 1.0) - link_failure (); - if (__builtin_creal (1.0 + 2.0i) != 1.0) - link_failure (); - if (cimag (dc) != 2.0) - abort (); - if (__builtin_cimag (dc) != 2.0) - abort (); - if (cimag (1.0 + 2.0i) != 2.0) - link_failure (); - if (__builtin_cimag (1.0 + 2.0i) != 2.0) - link_failure (); - /* Test long doubles. */ - if (conjl (ldc) != 1.0L - 2.0iL) - abort (); - if (__builtin_conjl (ldc) != 1.0L - 2.0iL) - abort (); - if (conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) - link_failure (); - if (__builtin_conjl (1.0L + 2.0iL) != 1.0L - 2.0iL) - link_failure (); - if (creall (ldc) != 1.0L) - abort (); - if (__builtin_creall (ldc) != 1.0L) - abort (); - if (creall (1.0L + 2.0iL) != 1.0L) - link_failure (); - if (__builtin_creall (1.0L + 2.0iL) != 1.0L) - link_failure (); - if (cimagl (ldc) != 2.0L) - abort (); - if (__builtin_cimagl (ldc) != 2.0L) - abort (); - if (cimagl (1.0L + 2.0iL) != 2.0L) - link_failure (); - if (__builtin_cimagl (1.0L + 2.0iL) != 2.0L) - link_failure (); - exit (0); -} - -/* All the above cases should have been optimized to something else, - even if not optimizing (unless -fno-builtin was specified). So any - remaining calls to the original functions should abort. */ - -static float _Complex -conjf (float _Complex z) -{ - abort (); -} - -static double _Complex -conj (double _Complex z) -{ - abort (); -} - -static long double _Complex -conjl (long double _Complex z) -{ - abort (); -} - -static float -crealf (float _Complex z) -{ - abort (); -} - -static double -creal (double _Complex z) -{ - abort (); -} - -static long double -creall (long double _Complex z) -{ - abort (); -} - -static float -cimagf (float _Complex z) -{ - abort (); -} - -static double -cimag (double _Complex z) -{ - abort (); -} - -static long double -cimagl (long double _Complex z) -{ - abort (); -} - -/* When optimizing, all the constant cases should have been - constant folded, so no calls to link_failure should remain. In any case, - link_failure should not be called. */ - -#ifndef __OPTIMIZE__ -void -link_failure (void) -{ - abort (); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x deleted file mode 100644 index 7a2e3146675..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x +++ /dev/null @@ -1,11 +0,0 @@ -set torture_eval_before_execute { - global compiler_conditional_xfail_data - set compiler_conditional_xfail_data { - "This test fails on all targets when optimizing." \ - { "*-*-*" } \ - { "-O1" } \ - { "" } - } -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c b/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c index a901c725f79..a998ef776f7 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c @@ -19,7 +19,6 @@ int main (void) && __builtin_types_compatible_p (typeof (hot), int) && __builtin_types_compatible_p (typeof (hot), typeof (laura)) && __builtin_types_compatible_p (int[5], int[]) - && __builtin_types_compatible_p (typeof (dingos), typeof (cranberry)) && __builtin_types_compatible_p (same1, same2))) abort (); @@ -28,6 +27,7 @@ int main (void) || __builtin_types_compatible_p (char *, const char *) || __builtin_types_compatible_p (long double, double) || __builtin_types_compatible_p (typeof (i), typeof (d)) + || __builtin_types_compatible_p (typeof (dingos), typeof (cranberry)) || __builtin_types_compatible_p (char, int) || __builtin_types_compatible_p (char *, char **)) abort (); diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c index 1584515af78..6ca246d3922 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c @@ -9,7 +9,6 @@ int abs_called = 0; extern int abs (int); extern long labs (long); extern void abort (void); -extern void exit (int); void main_test (void) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c index cfd79baef47..6f3c3170cc1 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c @@ -9,3 +9,15 @@ main () inside_main = 0; return 0; } + +/* When optimizing, all the constant cases should have been + constant folded, so no calls to link_error should remain. + In any case, link_error should not be called. */ + +#ifndef __OPTIMIZE__ +void +link_error (void) +{ + abort (); +} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c index 737a48f63dc..fa43c934312 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c @@ -20,7 +20,7 @@ strstr(const char *s1, const char *s2) break; p++, q++; } - if (*q == 0) + if (*p == *q && *p == 0) return (char *)s1; } return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c deleted file mode 100644 index c9d8b8da7b9..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "lib/strrchr.c" -#include "lib/strlen.c" -#include "lib/strcmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c deleted file mode 100644 index 8a60e7e80ae..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation. - - Ensure all expected transformations of builtin strlen, strcmp, - strrchr and rindex occur and perform correctly. - - Written by Jakub Jelinek, 11/7/2000. */ - -extern void abort (void); -extern __SIZE_TYPE__ strlen (const char *); -extern int strcmp (const char *, const char *); -extern char *strrchr (const char *, int); -extern char *rindex (const char *, int); - -int x = 6; -char *bar = "hi world"; - -void -main_test (void) -{ - const char *const foo = "hello world"; - - if (strlen (foo) != 11) - abort (); - if (strlen (foo + 4) != 7) - abort (); - if (strlen (foo + (x++ & 7)) != 5) - abort (); - if (x != 7) - abort (); - if (strcmp (foo, "hello") <= 0) - abort (); - if (strcmp (foo + 2, "llo") <= 0) - abort (); - if (strcmp (foo, foo) != 0) - abort (); - if (strcmp (foo, "hello world ") >= 0) - abort (); - if (strcmp (foo + 10, "dx") >= 0) - abort (); - if (strcmp (10 + foo, "dx") >= 0) - abort (); - if (strcmp (bar, "") <= 0) - abort (); - if (strcmp ("", bar) >= 0) - abort (); - if (strcmp (bar+8, "") != 0) - abort (); - if (strcmp ("", bar+8) != 0) - abort (); - if (strcmp (bar+(--x), "") <= 0 || x != 6) - abort (); - if (strcmp ("", bar+(++x)) >= 0 || x != 7) - abort (); - if (strrchr (foo, 'x')) - abort (); - if (strrchr (foo, 'o') != foo + 7) - abort (); - if (strrchr (foo, 'e') != foo + 1) - abort (); - if (strrchr (foo + 3, 'e')) - abort (); - if (strrchr (foo, '\0') != foo + 11) - abort (); - if (strrchr (bar, '\0') != bar + 8) - abort (); - if (strrchr (bar + 4, '\0') != bar + 8) - abort (); - if (strrchr (bar + (x++ & 3), '\0') != bar + 8) - abort (); - if (x != 8) - abort (); - /* Test only one instance of rindex since the code path is the same - as that of strrchr. */ - if (rindex ("hello", 'z') != 0) - abort (); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_rindex (foo, 'o') != foo + 7) - abort (); - if (__builtin_strrchr (foo, 'o') != foo + 7) - abort (); - if (__builtin_strlen (foo) != 11) - abort (); - if (__builtin_strcmp (foo, "hello") <= 0) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c deleted file mode 100644 index 9049fb9e1ff..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c +++ /dev/null @@ -1 +0,0 @@ -#include "lib/strchr.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c deleted file mode 100644 index 08e87c63d30..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation. - - Ensure all expected transformations of builtin strchr and index - occur and perform correctly. - - Written by Jakub Jelinek, 11/7/2000. */ - -extern void abort (void); -extern char *strchr (const char *, int); -extern char *index (const char *, int); - -void -main_test (void) -{ - const char *const foo = "hello world"; - - if (strchr (foo, 'x')) - abort (); - if (strchr (foo, 'o') != foo + 4) - abort (); - if (strchr (foo + 5, 'o') != foo + 7) - abort (); - if (strchr (foo, '\0') != foo + 11) - abort (); - /* Test only one instance of index since the code path is the same - as that of strchr. */ - if (index ("hello", 'z') != 0) - abort (); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strchr (foo, 'o') != foo + 4) - abort (); - if (__builtin_index (foo, 'o') != foo + 4) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c deleted file mode 100644 index d5326ffeb2b..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c +++ /dev/null @@ -1,17 +0,0 @@ -extern int inside_main; - -void * -memset (void *dst, int c, __SIZE_TYPE__ n) -{ - /* Single-byte memsets should be done inline when optimisation - is enabled. */ -#ifdef __OPTIMIZE__ - if (inside_main && n < 2) - abort (); -#endif - - while (n-- != 0) - n[(char *) dst] = c; - - return dst; -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c deleted file mode 100644 index cf7c1e303e8..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation. - - Ensure that builtin memset operations for constant length and - non-constant assigned value don't cause compiler problems. - - Written by Roger Sayle, 21 April 2002. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern void *memset (void *, int, size_t); - -char buffer[32]; -int argc = 1; - -void -main_test (void) -{ - memset (buffer, argc, 0); - memset (buffer, argc, 1); - memset (buffer, argc, 2); - memset (buffer, argc, 3); - memset (buffer, argc, 4); - memset (buffer, argc, 5); - memset (buffer, argc, 6); - memset (buffer, argc, 7); - memset (buffer, argc, 8); - memset (buffer, argc, 9); - memset (buffer, argc, 10); - memset (buffer, argc, 11); - memset (buffer, argc, 12); - memset (buffer, argc, 13); - memset (buffer, argc, 14); - memset (buffer, argc, 15); - memset (buffer, argc, 16); - memset (buffer, argc, 17); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c deleted file mode 100644 index 3b69c3baea8..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "lib/stpcpy.c" -#include "lib/mempcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c deleted file mode 100644 index 51819b1cfa9..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Ensure builtin mempcpy and stpcpy perform correctly. - - Written by Kaveh Ghazi, 4/11/2003. */ - -extern void abort (void); -extern char *strcpy (char *, const char *); -extern char *stpcpy (char *, const char *); -typedef __SIZE_TYPE__ size_t; -extern size_t strlen(const char *); -extern void *memcpy (void *, const void *, size_t); -extern void *mempcpy (void *, const void *, size_t); -extern int memcmp (const void *, const void *, size_t); -extern int inside_main; - -const char s1[] = "123"; -char p[32] = ""; -char *s2 = "defg"; -char *s3 = "FGH"; -size_t l1 = 1; - -void -main_test (void) -{ - int i; - -#if !defined __i386__ && !defined __x86_64__ - /* The functions below might not be optimized into direct stores on all - arches. It depends on how many instructions would be generated and - what limits the architecture chooses in STORE_BY_PIECES_P. */ - inside_main = 0; -#endif - - if (stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) - abort (); - if (stpcpy (p + 16, "vwxyz" + 1) != p + 16 + 4 || memcmp (p + 16, "wxyz", 5)) - abort (); - if (stpcpy (p + 1, "") != p + 1 + 0 || memcmp (p, "a\0cde", 6)) - abort (); - if (stpcpy (p + 3, "fghij") != p + 3 + 5 || memcmp (p, "a\0cfghij", 9)) - abort (); - if (mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) - abort (); - if (mempcpy (p + 16, "VWX" + 1, 2) != p + 16 + 2 || memcmp (p + 16, "WXyz", 5)) - abort (); - if (mempcpy (p + 1, "", 1) != p + 1 + 1 || memcmp (p, "A\0CDE", 6)) - abort (); - if (mempcpy (p + 3, "FGHI", 4) != p + 3 + 4 || memcmp (p, "A\0CFGHIj", 9)) - abort (); - - i = 8; - memcpy (p + 20, "qrstu", 6); - if (stpcpy ((i++, p + 20 + 1), "23") != (p + 20 + 1 + 2) || i != 9 || memcmp (p + 20, "q23\0u", 6)) - abort (); - - memcpy (p + 25, "QRSTU", 6); - if (mempcpy (p + 25 + 1, s1, 3) != (p + 25 + 1 + 3) || memcmp (p + 25, "Q123U", 6)) - abort (); - - if (stpcpy (stpcpy (p, "ABCD"), "EFG") != p + 7 || memcmp (p, "ABCDEFG", 8)) - abort(); - if (mempcpy (mempcpy (p, "abcdEFG", 4), "efg", 4) != p + 8 || memcmp (p, "abcdefg", 8)) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6)) - abort (); - if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) - abort (); - - /* If the result of stpcpy/mempcpy is ignored, gcc should use - strcpy/memcpy. This should be optimized always, so set inside_main - again. */ - inside_main = 1; - stpcpy (p + 3, s2); - if (memcmp (p, "ABCdefg", 8)) - abort (); - mempcpy (p + 5, s3, 1); - if (memcmp (p, "ABCdeFg", 8)) - abort (); - mempcpy (p + 6, s3 + 1, l1); - if (memcmp (p, "ABCdeFG", 8)) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c deleted file mode 100644 index 5be3df52fe5..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c +++ /dev/null @@ -1 +0,0 @@ -#include "lib/memmove.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c deleted file mode 100644 index 4a18fc6400f..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Ensure builtin memmove and bcopy perform correctly. - - Written by Jakub Jelinek, 4/26/2003. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern void *memmove (void *, const void *, size_t); -extern void bcopy (const void *, void *, size_t); -extern int memcmp (const void *, const void *, size_t); - -const char s1[] = "123"; -char p[32] = ""; - -static const struct foo -{ - char *s; - double d; - long l; -} foo[] = -{ - { "hello world1", 3.14159, 101L }, - { "hello world2", 3.14159, 102L }, - { "hello world3", 3.14159, 103L }, - { "hello world4", 3.14159, 104L }, - { "hello world5", 3.14159, 105L }, - { "hello world6", 3.14159, 106L } -}; - -static const struct bar -{ - char *s; - const struct foo f[3]; -} bar[] = -{ - { - "hello world10", - { - { "hello1", 3.14159, 201L }, - { "hello2", 3.14159, 202L }, - { "hello3", 3.14159, 203L }, - } - }, - { - "hello world11", - { - { "hello4", 3.14159, 204L }, - { "hello5", 3.14159, 205L }, - { "hello6", 3.14159, 206L }, - } - } -}; - -static const int baz[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; - -void -main_test (void) -{ - const char *s; - struct foo f1[sizeof foo/sizeof*foo]; - struct bar b1[sizeof bar/sizeof*bar]; - int bz[sizeof baz/sizeof*baz]; - - if (memmove (f1, foo, sizeof (foo)) != f1 || memcmp (f1, foo, sizeof(foo))) - abort(); - if (memmove (b1, bar, sizeof (bar)) != b1 || memcmp (b1, bar, sizeof(bar))) - abort(); - bcopy (baz, bz, sizeof (baz)); - if (memcmp (bz, baz, sizeof(baz))) - abort(); - - if (memmove (p, "abcde", 6) != p || memcmp (p, "abcde", 6)) - abort (); - s = s1; - if (memmove (p + 2, ++s, 0) != p + 2 || memcmp (p, "abcde", 6) || s != s1 + 1) - abort (); - if (__builtin_memmove (p + 3, "", 1) != p + 3 || memcmp (p, "abc\0e", 6)) - abort (); - bcopy ("fghijk", p + 2, 4); - if (memcmp (p, "abfghi", 7)) - abort (); - s = s1 + 1; - bcopy (s++, p + 1, 0); - if (memcmp (p, "abfghi", 7) || s != s1 + 2) - abort (); - __builtin_bcopy ("ABCDE", p + 4, 1); - if (memcmp (p, "abfgAi", 7)) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c deleted file mode 100644 index 029a92e77d5..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c +++ /dev/null @@ -1 +0,0 @@ -#include "lib/memcmp.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c deleted file mode 100644 index 869dba17baa..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - - Ensure that builtin memcmp operations when all three arguments - are constant is optimized and performs correctly. Taken from - PR optimize/3508. - - Written by Roger Sayle, 12/26/2001. */ - -extern void abort (void); -extern void link_error (void); - -typedef __SIZE_TYPE__ size_t; -extern int memcmp (const void *, const void *, size_t); - -void -main_test (void) -{ - if (memcmp ("abcd", "efgh", 4) >= 0) - link_error (); - if (memcmp ("abcd", "abcd", 4) != 0) - link_error (); - if (memcmp ("efgh", "abcd", 4) <= 0) - link_error (); -} - -#ifndef __OPTIMIZE__ -/* When not optimizing, the above tests may generate references to - the function link_error, but should never actually call it. */ -void -link_error () -{ - abort (); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c deleted file mode 100644 index 3b69c3baea8..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "lib/stpcpy.c" -#include "lib/mempcpy.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c deleted file mode 100644 index 5eb1ac4af78..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Ensure that builtin mempcpy and stpcpy perform correctly. - - Written by Jakub Jelinek, 21/05/2003. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern void *mempcpy (void *, const void *, size_t); -extern int memcmp (const void *, const void *, size_t); -extern char *stpcpy (char *, const char *); -extern int inside_main; - -long buf1[64]; -char *buf2 = (char *) (buf1 + 32); -long buf5[20]; -char buf7[20]; - -int -__attribute__((noinline)) -test (long *buf3, char *buf4, char *buf6, int n) -{ - int i = 0; - - /* These should probably be handled by store_by_pieces on most arches. */ - if (mempcpy (buf1, "ABCDEFGHI", 9) != (char *) buf1 + 9 - || memcmp (buf1, "ABCDEFGHI\0", 11)) - abort (); - - if (mempcpy (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + 17 - || memcmp (buf1, "abcdefghijklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf3, "ABCDEF", 6) != (char *) buf1 + 6 - || memcmp (buf1, "ABCDEFghijklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf3, "a", 1) != (char *) buf1 + 1 - || memcmp (buf1, "aBCDEFghijklmnopq\0", 19)) - abort (); - - if (mempcpy ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 4 - || memcmp (buf1, "aBcdEFghijklmnopq\0", 19) - || i != 1) - abort (); - - /* These should probably be handled by move_by_pieces on most arches. */ - if (mempcpy ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 10 - || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1) - != (char *) buf1 + 11 - || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19) - || i != 2) - abort (); - - if (mempcpy ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 16 - || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19)) - abort (); - - if (mempcpy (buf3, buf5, 8) != (char *) buf1 + 8 - || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19)) - abort (); - - if (mempcpy (buf3, buf5, 17) != (char *) buf1 + 17 - || memcmp (buf1, "RSTUVWXYZ01234567\0", 19)) - abort (); - - __builtin_memcpy (buf3, "aBcdEFghijklmnopq\0", 19); - - /* These should be handled either by movstrendM or mempcpy - call. */ - if (mempcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 10 - || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, n + 1) - != (char *) buf1 + 12 - || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19) - || i != 3) - abort (); - - if (mempcpy ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 16 - || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19)) - abort (); - - i = 1; - - /* These might be handled by store_by_pieces. */ - if (mempcpy (buf2, "ABCDEFGHI", 9) != buf2 + 9 - || memcmp (buf2, "ABCDEFGHI\0", 11)) - abort (); - - if (mempcpy (buf2, "abcdefghijklmnopq", 17) != buf2 + 17 - || memcmp (buf2, "abcdefghijklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf4, "ABCDEF", 6) != buf2 + 6 - || memcmp (buf2, "ABCDEFghijklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf4, "a", 1) != buf2 + 1 - || memcmp (buf2, "aBCDEFghijklmnopq\0", 19)) - abort (); - - if (mempcpy (buf4 + 2, "bcd" + i++, 2) != buf2 + 4 - || memcmp (buf2, "aBcdEFghijklmnopq\0", 19) - || i != 2) - abort (); - - /* These might be handled by move_by_pieces. */ - if (mempcpy (buf4 + 4, buf7, 6) != buf2 + 10 - || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, 1) - != buf2 + 11 - || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19) - || i != 3) - abort (); - - if (mempcpy (buf4 + 14, buf6, 2) != buf2 + 16 - || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19)) - abort (); - - __builtin_memcpy (buf4, "aBcdEFghijklmnopq\0", 19); - - /* These should be handled either by movstrendM or mempcpy - call. */ - if (mempcpy (buf4 + 4, buf7, n + 6) != buf2 + 10 - || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19)) - abort (); - - if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, n + 1) - != buf2 + 12 - || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19) - || i != 4) - abort (); - - if (mempcpy (buf4 + 14, buf6, n + 2) != buf2 + 16 - || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19)) - abort (); - - /* Now stpcpy tests. */ - if (stpcpy ((char *) buf3, "abcdefghijklmnop") != (char *) buf1 + 16 - || memcmp (buf1, "abcdefghijklmnop", 17)) - abort (); - - if (__builtin_stpcpy ((char *) buf3, "ABCDEFG") != (char *) buf1 + 7 - || memcmp (buf1, "ABCDEFG\0ijklmnop", 17)) - abort (); - - if (stpcpy ((char *) buf3 + i++, "x") != (char *) buf1 + 5 - || memcmp (buf1, "ABCDx\0G\0ijklmnop", 17)) - abort (); - - return 0; -} - -void -main_test (void) -{ - /* All these tests are allowed to call mempcpy/stpcpy. */ - inside_main = 0; - __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20); - __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20); - test (buf1, buf2, "rstuvwxyz", 0); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c deleted file mode 100644 index 9753c2498f1..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c +++ /dev/null @@ -1 +0,0 @@ -#include "lib/strlen.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c deleted file mode 100644 index 220b6ed8e2e..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Test strlen optimizations on conditional expressions. - - Written by Jakub Jelinek, June 23, 2003. */ - -typedef __SIZE_TYPE__ size_t; -extern char *strcpy (char *, const char *); -extern int memcmp (const void *, const void *, size_t); -extern void abort (void); -extern void exit (int); -extern int inside_main; - -size_t g, h, i, j, k, l; - -size_t -foo (void) -{ - if (l) - abort (); - return ++l; -} - -void -main_test (void) -{ - if (strlen (i ? "foo" + 1 : j ? "bar" + 1 : "baz" + 1) != 2) - abort (); - if (strlen (g++ ? "foo" : "bar") != 3 || g != 1) - abort (); - if (strlen (h++ ? "xfoo" + 1 : "bar") != 3 || h != 1) - abort (); - if (strlen ((i++, "baz")) != 3 || i != 1) - abort (); - /* The following calls might not optimize strlen call away. */ - inside_main = 0; - if (strlen (j ? "foo" + k++ : "bar" + k++) != 3 || k != 1) - abort (); - if (strlen (foo () ? "foo" : "bar") != 3 || l != 1) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c deleted file mode 100644 index 0a0bbb8865a..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c +++ /dev/null @@ -1 +0,0 @@ -#include "lib/strcat.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c deleted file mode 100644 index ba70c397724..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation. - - Ensure all expected transformations of builtin strcat occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/27/2000. */ - -extern int inside_main; -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern char *strcat (char *, const char *); -extern char *strcpy (char *, const char *); -extern int strcmp (const char *, const char *); -extern void *memset (void *, int, size_t); -extern int memcmp (const void *, const void *, size_t); -#define RESET_DST_WITH(FILLER) \ - do { memset (dst, 'X', sizeof (dst)); strcpy (dst, (FILLER)); } while (0) - -void main_test (void) -{ - const char *const s1 = "hello world"; - const char *const s2 = ""; - char dst[64], *d2; - - RESET_DST_WITH (s1); - if (strcat (dst, "") != dst || strcmp (dst, s1)) - abort(); - RESET_DST_WITH (s1); - if (strcat (dst, s2) != dst || strcmp (dst, s1)) - abort(); - RESET_DST_WITH (s1); d2 = dst; - if (strcat (++d2, s2) != dst+1 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - RESET_DST_WITH (s1); d2 = dst; - if (strcat (++d2+5, s2) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - RESET_DST_WITH (s1); d2 = dst; - if (strcat (++d2+5, s1+11) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - -#ifndef __OPTIMIZE_SIZE__ -# if !defined __i386__ && !defined __x86_64__ - /* The functions below might not be optimized into direct stores on all - arches. It depends on how many instructions would be generated and - what limits the architecture chooses in STORE_BY_PIECES_P. */ - inside_main = 0; -# endif - - RESET_DST_WITH (s1); - if (strcat (dst, " 1111") != dst - || memcmp (dst, "hello world 1111\0XXX", 20)) - abort(); - - RESET_DST_WITH (s1); - if (strcat (dst+5, " 2222") != dst+5 - || memcmp (dst, "hello world 2222\0XXX", 20)) - abort(); - - RESET_DST_WITH (s1); d2 = dst; - if (strcat (++d2+5, " 3333") != dst+6 || d2 != dst+1 - || memcmp (dst, "hello world 3333\0XXX", 20)) - abort(); - - RESET_DST_WITH (s1); - strcat (strcat (strcat (strcat (strcat (strcat (dst, ": this "), ""), - "is "), "a "), "test"), "."); - if (memcmp (dst, "hello world: this is a test.\0X", 30)) - abort(); - - /* Set inside_main again. */ - inside_main = 1; -#endif - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - RESET_DST_WITH (s1); - if (__builtin_strcat (dst, "") != dst || strcmp (dst, s1)) - abort(); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c deleted file mode 100644 index a0318212e67..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c +++ /dev/null @@ -1,31 +0,0 @@ -extern int inside_main; -extern const char *p; - -char * -my_strstr (const char *s1, const char *s2) -{ - __SIZE_TYPE__ len = strlen (s2); - -#ifdef __OPTIMIZE__ - /* If optimizing, we should be called only in the strstr (foo + 2, p) - case. All other cases should be optimized. */ - if (inside_main) - if (s2 != p || strcmp (s1, "hello world" + 2) != 0) - abort (); -#endif - if (len == 0) - return (char *) s1; - for (s1 = strchr (s1, *s2); s1; s1 = strchr (s1 + 1, *s2)) - if (strncmp (s1, s2, len) == 0) - return (char *) s1; - return (char *) 0; -} - -char * -strstr (const char *s1, const char *s2) -{ - if (inside_main) - abort (); - - return my_strstr (s1, s2); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c deleted file mode 100644 index 3c3e45dfa5d..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation. - - Ensure all expected transformations of builtin strstr occur and - perform correctly in presence of redirect. */ - -#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) -#define ASMNAME2(prefix, cname) STRING (prefix) cname -#define STRING(x) #x - -typedef __SIZE_TYPE__ size_t; -extern void abort (void); -extern char *strstr (const char *, const char *) - __asm (ASMNAME ("my_strstr")); - -const char *p = "rld", *q = "hello world"; - -void -main_test (void) -{ - const char *const foo = "hello world"; - - if (strstr (foo, "") != foo) - abort (); - if (strstr (foo + 4, "") != foo + 4) - abort (); - if (strstr (foo, "h") != foo) - abort (); - if (strstr (foo, "w") != foo + 6) - abort (); - if (strstr (foo + 6, "o") != foo + 7) - abort (); - if (strstr (foo + 1, "world") != foo + 6) - abort (); - if (strstr (foo + 2, p) != foo + 8) - abort (); - if (strstr (q, "") != q) - abort (); - if (strstr (q + 1, "o") != q + 4) - abort (); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strstr (foo + 1, "world") != foo + 6) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c deleted file mode 100644 index 16369a21794..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c +++ /dev/null @@ -1,76 +0,0 @@ -extern int inside_main; -typedef __SIZE_TYPE__ size_t; - -#define TEST_ABORT if (inside_main) abort() - -void * -my_memcpy (void *d, const void *s, size_t n) -{ - char *dst = (char *) d; - const char *src = (const char *) s; - while (n--) - *dst++ = *src++; - return (char *) d; -} - -void -my_bcopy (const void *s, void *d, size_t n) -{ - char *dst = (char *) d; - const char *src = (const char *) s; - if (src >= dst) - while (n--) - *dst++ = *src++; - else - { - dst += n; - src += n; - while (n--) - *--dst = *--src; - } -} - -void * -my_memset (void *d, int c, size_t n) -{ - char *dst = (char *) d; - while (n--) - *dst++ = c; - return (char *) d; -} - -void -my_bzero (void *d, size_t n) -{ - char *dst = (char *) d; - while (n--) - *dst++ = '\0'; -} - -void * -memcpy (void *d, const void *s, size_t n) -{ - TEST_ABORT; - return my_memcpy (d, s, n); -} - -void -bcopy (const void *s, void *d, size_t n) -{ - TEST_ABORT; - my_bcopy (s, d, n); -} - -void * -memset (void *d, int c, size_t n) -{ - TEST_ABORT; - return my_memset (d, c, n); -} - -void -bzero (void *d, size_t n) -{ - TEST_ABORT; - my_bzero (d, n); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c deleted file mode 100644 index e793778053a..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Test memcpy and memset in presence of redirect. */ - -#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) -#define ASMNAME2(prefix, cname) STRING (prefix) cname -#define STRING(x) #x - -typedef __SIZE_TYPE__ size_t; -extern void abort (void); -extern void *memcpy (void *, const void *, size_t) - __asm (ASMNAME ("my_memcpy")); -extern void bcopy (const void *, void *, size_t) - __asm (ASMNAME ("my_bcopy")); -extern void *memset (void *, int, size_t) - __asm (ASMNAME ("my_memset")); -extern void bzero (void *, size_t) - __asm (ASMNAME ("my_bzero")); -extern int memcmp (const void *, const void *, size_t); - -struct A { char c[32]; } a = { "foobar" }; -char x[64] = "foobar", y[64]; -int i = 39, j = 6, k = 4; - -void -main_test (void) -{ - struct A b = a; - struct A c = { { 'x' } }; - - if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31)) - abort (); - if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64)) - abort (); - if (memcpy (y + 6, x, j) != y + 6 - || memcmp (x, y, 6) || memcmp (x, y + 6, 58)) - abort (); - if (__builtin_memset (y + 2, 'X', k) != y + 2 - || memcmp (y, "foXXXXfoobar", 13)) - abort (); - bcopy (y + 1, y + 2, 6); - if (memcmp (y, "fooXXXXfobar", 13)) - abort (); - __builtin_bzero (y + 4, 2); - if (memcmp (y, "fooX\0\0Xfobar", 13)) - abort (); -} diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c index bf648b3440c..3bf9a26f655 100644 --- a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c @@ -1,13 +1,8 @@ #include <stdlib.h> -#if !defined(NO_LABEL_VALUES) && (!defined(STACK_SIZE) || STACK_SIZE >= 4000) -#if __INT_MAX__ == 32767 -typedef unsigned long uint32; -typedef signed long sint32; -#else +#if !defined(NO_LABEL_VALUES) && (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647 typedef unsigned int uint32; typedef signed int sint32; -#endif typedef uint32 reg_t; diff --git a/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c b/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c index 4a8488d0ab4..76328c21c2e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/compndlit-1.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else struct S { int a:3; @@ -13,3 +22,4 @@ main () abort (); exit (0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/divconst-3.x b/gcc/testsuite/gcc.c-torture/execute/divconst-3.x deleted file mode 100644 index ca8e06c4077..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/divconst-3.x +++ /dev/null @@ -1,5 +0,0 @@ -if { [istarget "h8300*-*-*"] } { - return 1 -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x index 0098d561c45..d53f8c23ee2 100644 --- a/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/eeprof-1.x @@ -1,2 +1,5 @@ +if { [istarget "powerpc-ibm-aix*"] } { + set torture_execute_xfail "powerpc-ibm-aix*" +} set additional_flags "-finstrument-functions" return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/extzvsi.c b/gcc/testsuite/gcc.c-torture/execute/extzvsi.c index ba251271896..81f16185d21 100644 --- a/gcc/testsuite/gcc.c-torture/execute/extzvsi.c +++ b/gcc/testsuite/gcc.c-torture/execute/extzvsi.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else /* Failed on powerpc due to bad extzvsi pattern. */ struct ieee @@ -29,3 +38,4 @@ main (void) abort (); return 0; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.x index 35f7a0a7d99..3fc750e85af 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.x +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-3.x @@ -1,2 +1,2 @@ -lappend additional_flags "-fno-trapping-math" +set options "-fno-trapping-math" return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x index 35f7a0a7d99..3fc750e85af 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x @@ -1,2 +1,2 @@ -lappend additional_flags "-fno-trapping-math" +set options "-fno-trapping-math" return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c index 45527a23aff..d4bb9c6c6b5 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4.c @@ -1,5 +1,9 @@ +#ifndef FLOAT +#define FLOAT double +#endif + void -test_isunordered(double x, double y, int true) +test_isunordered(FLOAT x, FLOAT y, int true) { if (__builtin_isunordered(x, y)) { @@ -14,7 +18,7 @@ test_isunordered(double x, double y, int true) } void -test_isless(double x, double y, int true) +test_isless(FLOAT x, FLOAT y, int true) { if (__builtin_isless(x, y)) { @@ -29,7 +33,7 @@ test_isless(double x, double y, int true) } void -test_islessequal(double x, double y, int true) +test_islessequal(FLOAT x, FLOAT y, int true) { if (__builtin_islessequal(x, y)) { @@ -44,7 +48,7 @@ test_islessequal(double x, double y, int true) } void -test_isgreater(double x, double y, int true) +test_isgreater(FLOAT x, FLOAT y, int true) { if (__builtin_isgreater(x, y)) { @@ -59,7 +63,7 @@ test_isgreater(double x, double y, int true) } void -test_isgreaterequal(double x, double y, int true) +test_isgreaterequal(FLOAT x, FLOAT y, int true) { if (__builtin_isgreaterequal(x, y)) { @@ -74,7 +78,7 @@ test_isgreaterequal(double x, double y, int true) } void -test_islessgreater(double x, double y, int true) +test_islessgreater(FLOAT x, FLOAT y, int true) { if (__builtin_islessgreater(x, y)) { @@ -95,7 +99,7 @@ main() { struct try { - double x, y; + FLOAT x, y; unsigned unord : 1; unsigned lt : 1; unsigned le : 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4q.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4q.c new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4q.c diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c index 225539b83eb..7e24c66d98d 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8.c @@ -1,81 +1,85 @@ +#ifndef FLOAT +#define FLOAT double +#endif + /* Like fp-cmp-4.c, but test that the cmove patterns are correct. */ -static double -test_isunordered(double x, double y, double a, double b) +static FLOAT +test_isunordered(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_isunordered(x, y) ? a : b; } -static double -test_not_isunordered(double x, double y, double a, double b) +static FLOAT +test_not_isunordered(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_isunordered(x, y) ? a : b; } -static double -test_isless(double x, double y, double a, double b) +static FLOAT +test_isless(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_isless(x, y) ? a : b; } -static double -test_not_isless(double x, double y, double a, double b) +static FLOAT +test_not_isless(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_isless(x, y) ? a : b; } -static double -test_islessequal(double x, double y, double a, double b) +static FLOAT +test_islessequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_islessequal(x, y) ? a : b; } -static double -test_not_islessequal(double x, double y, double a, double b) +static FLOAT +test_not_islessequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_islessequal(x, y) ? a : b; } -static double -test_isgreater(double x, double y, double a, double b) +static FLOAT +test_isgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_isgreater(x, y) ? a : b; } -static double -test_not_isgreater(double x, double y, double a, double b) +static FLOAT +test_not_isgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_isgreater(x, y) ? a : b; } -static double -test_isgreaterequal(double x, double y, double a, double b) +static FLOAT +test_isgreaterequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_isgreaterequal(x, y) ? a : b; } -static double -test_not_isgreaterequal(double x, double y, double a, double b) +static FLOAT +test_not_isgreaterequal(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_isgreaterequal(x, y) ? a : b; } -static double -test_islessgreater(double x, double y, double a, double b) +static FLOAT +test_islessgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return __builtin_islessgreater(x, y) ? a : b; } -static double -test_not_islessgreater(double x, double y, double a, double b) +static FLOAT +test_not_islessgreater(FLOAT x, FLOAT y, FLOAT a, FLOAT b) { return !__builtin_islessgreater(x, y) ? a : b; } static void -one_test(double x, double y, int expected, - double (*pos) (double, double, double, double), - double (*neg) (double, double, double, double)) +one_test(FLOAT x, FLOAT y, int expected, + FLOAT (*pos) (FLOAT, FLOAT, FLOAT, FLOAT), + FLOAT (*neg) (FLOAT, FLOAT, FLOAT, FLOAT)) { if (((*pos)(x, y, 1.0, 2.0) == 1.0) != expected) abort (); @@ -91,7 +95,7 @@ main() { struct try { - double x, y; + FLOAT x, y; int result[6]; }; @@ -115,8 +119,8 @@ main() struct test { - double (*pos)(double, double, double, double); - double (*neg)(double, double, double, double); + FLOAT (*pos)(FLOAT, FLOAT, FLOAT, FLOAT); + FLOAT (*neg)(FLOAT, FLOAT, FLOAT, FLOAT); }; static struct test const tests[] = diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8q.c b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8q.c new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8q.c diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp index 6b23a4ec5e2..207c6751d48 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp @@ -24,8 +24,8 @@ # C torture test suite, and other contributors. # -# VAX does not have hardware support for IEEE arithmetic. -if { [istarget "vax-*-*"] } { return } +# Disable tests on machines with no hardware support for IEEE arithmetic. +if { [istarget "vax-*-*"] || [ istarget "powerpc-*-*spe"] } { return } if $tracelevel then { strace $tracelevel diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2e.x b/gcc/testsuite/gcc.c-torture/execute/loop-2e.x index d7b9f285097..9836850d8b2 100644 --- a/gcc/testsuite/gcc.c-torture/execute/loop-2e.x +++ b/gcc/testsuite/gcc.c-torture/execute/loop-2e.x @@ -1,11 +1,4 @@ -# This doesn't work on m68k-motorola-sysv -# It also doesn't work on m88k-motorola-sysv3 - global target_triplet -if { [istarget "m68k-motorola-sysv"] || [istarget "m88k-motorola-sysv3"] } { - set torture_compile_xfail "$target_triplet" -} - if { [istarget "i?86-*"] } { set torture_eval_before_execute { global compiler_conditional_xfail_data diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2f.x b/gcc/testsuite/gcc.c-torture/execute/loop-2f.x deleted file mode 100644 index e68b8fbb8d2..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/loop-2f.x +++ /dev/null @@ -1,9 +0,0 @@ -# This doesn't work on m68k-motorola-sysv -# It also doesn't work on m88k-motorola-sysv3 - -global target_triplet -if { [istarget "m68k-motorola-sysv"] || [istarget "m88k-motorola-sysv3"] } { - set torture_compile_xfail "$target_triplet" -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-2g.x b/gcc/testsuite/gcc.c-torture/execute/loop-2g.x deleted file mode 100644 index e68b8fbb8d2..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/loop-2g.x +++ /dev/null @@ -1,9 +0,0 @@ -# This doesn't work on m68k-motorola-sysv -# It also doesn't work on m88k-motorola-sysv3 - -global target_triplet -if { [istarget "m68k-motorola-sysv"] || [istarget "m88k-motorola-sysv3"] } { - set torture_compile_xfail "$target_triplet" -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c index 65e9438312b..d61a3136706 100644 --- a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c +++ b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c @@ -161,7 +161,7 @@ void z(int n, ...) while (n--) { int *a = va_arg (list, int *); - bzero (a, sizeof (l)); + __builtin_bzero (a, sizeof (l)); } va_end (list); } diff --git a/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c b/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c index 2c6108b52e6..492670b5a1e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/nest-stdar-1.c @@ -2,7 +2,7 @@ main () { - static double f (int x, ...) + double f (int x, ...) { va_list args; double a; diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-1.c b/gcc/testsuite/gcc.c-torture/execute/simd-1.c index e103fd7244a..df9f1a90798 100644 --- a/gcc/testsuite/gcc.c-torture/execute/simd-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/simd-1.c @@ -4,7 +4,7 @@ regardless of if the target has SIMD instructions. */ -typedef int __attribute__((mode(V4SI))) vecint; +typedef int __attribute__((vector_size (16))) vecint; typedef int __attribute__((mode(SI))) siint; vecint i = { 150, 100, 150, 200 }; diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-2.c b/gcc/testsuite/gcc.c-torture/execute/simd-2.c index 2d1b92228f7..d4f506a7641 100644 --- a/gcc/testsuite/gcc.c-torture/execute/simd-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/simd-2.c @@ -3,7 +3,7 @@ regardless of if the target has SIMD instructions. */ -typedef int __attribute__((mode(V8HI))) vecint; +typedef short __attribute__((vector_size (16))) vecint; vecint i = { 150, 100, 150, 200, 0, 0, 0, 0 }; vecint j = { 10, 13, 20, 30, 1, 1, 1, 1 }; diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-4.x b/gcc/testsuite/gcc.c-torture/execute/simd-4.x new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-4.x diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-5.x b/gcc/testsuite/gcc.c-torture/execute/simd-5.x new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/simd-5.x diff --git a/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c b/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c index 3d32ec8b422..24ba732438c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c @@ -13,17 +13,14 @@ foo (int v, va_list ap) switch (v) { case 5: - foo_arg = va_arg (ap, int); - foo_arg += va_arg (ap, double); + foo_arg = va_arg (ap, int) + va_arg (ap, double); foo_arg += va_arg (ap, long long); break; case 8: - foo_arg = va_arg (ap, long long); - foo_arg += va_arg (ap, double); + foo_arg = va_arg (ap, long long) + va_arg (ap, double); break; case 11: - foo_arg = va_arg (ap, int); - foo_arg += va_arg (ap, long double); + foo_arg = va_arg (ap, int) + va_arg (ap, long double); break; default: abort (); diff --git a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c b/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c deleted file mode 100644 index 8cfb4ebe08e..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation. - - Ensure all expected transformations of builtin fputs occur and that - we honor side effects in the stream argument. - - Written by Kaveh R. Ghazi, 10/30/2000. */ - -#include <stdio.h> -extern void abort(void); -/* Declare this without args because that's what gcc does internally. - We want to make sure it works without a helpful prototype from us. - If stdio.h provides one, that is okay. */ -extern int fputs(); - -int i; - -int main() -{ - FILE *s_array[] = {stdout, NULL}, **s_ptr = s_array; - const char *const s1 = "hello world"; - - fputs ("", *s_ptr); - fputs ("\n", *s_ptr); - fputs ("bye", *s_ptr); - fputs (s1, *s_ptr); - fputs (s1+5, *s_ptr); - fputs (s1+10, *s_ptr); - fputs (s1+11, *s_ptr); - - /* Check side-effects when transforming fputs -> NOP. */ - fputs ("", *s_ptr++); - if (s_ptr != s_array+1 || *s_ptr != 0) - abort(); - - /* Check side-effects when transforming fputs -> fputc. */ - s_ptr = s_array; - fputs ("\n", *s_ptr++); - if (s_ptr != s_array+1 || *s_ptr != 0) - abort(); - - /* Check side-effects when transforming fputs -> fwrite. */ - s_ptr = s_array; - fputs ("hello\n", *s_ptr++); - if (s_ptr != s_array+1 || *s_ptr != 0) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - s_ptr = s_array; - __builtin_fputs ("", *s_ptr); - /* These builtin stubs are called by __builtin_fputs, ensure their - prototypes are set correctly too. */ - __builtin_fputc ('\n', *s_ptr); - __builtin_fwrite ("hello\n", 1, 6, *s_ptr); - - /* Check side-effects in conditional expression. */ - s_ptr = s_array; - fputs (i++ ? "f" : "x", *s_ptr++); - if (s_ptr != s_array+1 || *s_ptr != 0 || i != 1) - abort(); - fputs (--i ? "\n" : "\n", *--s_ptr); - if (s_ptr != s_array || i != 0) - abort(); - - return 0; -} - -#if defined (__OPTIMIZE__) && ! defined (__OPTIMIZE_SIZE__) -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static int -fputs(const char *string, FILE *stream) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-2.c b/gcc/testsuite/gcc.c-torture/execute/stdio-opt-2.c deleted file mode 100644 index 833017ee547..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-2.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin printf occur and - that we honor side effects in the arguments. - - Written by Kaveh R. Ghazi, 12/4/2000. */ - -extern int printf (const char *, ...); -extern void abort(void); - -int main() -{ - const char *const s1 = "hello world"; - const char *const s2[] = { s1, 0 }, *const*s3; - - printf ("%s\n", "hello"); - printf ("%s\n", *s2); - s3 = s2; - printf ("%s\n", *s3++); - if (s3 != s2+1 || *s3 != 0) - abort(); - - printf ("%c", '\n'); - printf ("%c", **s2); - s3 = s2; - printf ("%c", **s3++); - if (s3 != s2+1 || *s3 != 0) - abort(); - - printf ("\n"); - printf ("hello world\n"); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - __builtin_printf ("%s\n", "hello"); - /* These builtin stubs are called by __builtin_printf, ensure their - prototypes are set correctly too. */ - __builtin_putchar ('\n'); - __builtin_puts ("hello"); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static int -printf (const char *string, ...) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-3.c b/gcc/testsuite/gcc.c-torture/execute/stdio-opt-3.c deleted file mode 100644 index afc76a21716..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-3.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - - Ensure all expected transformations of builtin fprintf occur and - that we honor side effects in the arguments. - - Written by Kaveh R. Ghazi, 1/7/2001. */ - -#include <stdio.h> -extern int fprintf (FILE *, const char *, ...); -extern void abort(void); - -int main() -{ - FILE *s_array[] = {stdout, NULL}, **s_ptr = s_array; - const char *const s1 = "hello world"; - const char *const s2[] = { s1, 0 }, *const*s3; - - fprintf (*s_ptr, "%s", "hello"); - fprintf (*s_ptr, "%s", "\n"); - fprintf (*s_ptr, "%s", *s2); - s3 = s2; - fprintf (*s_ptr, "%s", *s3++); - if (s3 != s2+1 || *s3 != 0) - abort(); - s3 = s2; - fprintf (*s_ptr++, "%s", *s3++); - if (s3 != s2+1 || *s3 != 0 || s_ptr != s_array+1 || *s_ptr != 0) - abort(); - - s_ptr = s_array; - fprintf (*s_ptr, "%c", '\n'); - fprintf (*s_ptr, "%c", **s2); - s3 = s2; - fprintf (*s_ptr, "%c", **s3++); - if (s3 != s2+1 || *s3 != 0) - abort(); - s3 = s2; - fprintf (*s_ptr++, "%c", **s3++); - if (s3 != s2+1 || *s3 != 0 || s_ptr != s_array+1 || *s_ptr != 0) - abort(); - - s_ptr = s_array; - fprintf (*s_ptr++, "hello world"); - if (s_ptr != s_array+1 || *s_ptr != 0) - abort(); - s_ptr = s_array; - fprintf (*s_ptr, "\n"); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - __builtin_fprintf (*s_ptr, "%s", "hello world\n"); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static int -fprintf (FILE *stream, const char *string, ...) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.x b/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.x deleted file mode 100644 index 850736e82dc..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.x +++ /dev/null @@ -1,7 +0,0 @@ -# This doesn't work on mn10200 - -if { [istarget "mn10200*-*-*"] } { - set torture_execute_xfail "mn10200*-*-*" -} - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-1.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-1.c deleted file mode 100644 index 6b59c10f29b..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin strstr occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/6/2000. */ - -extern void abort(void); -extern char *strstr (const char *, const char *); - -int main() -{ - const char *const foo = "hello world"; - - if (strstr (foo, "") != foo) - abort(); - if (strstr (foo + 4, "") != foo + 4) - abort(); - if (strstr (foo, "h") != foo) - abort(); - if (strstr (foo, "w") != foo + 6) - abort(); - if (strstr (foo + 6, "o") != foo + 7) - abort(); - if (strstr (foo + 1, "world") != foo + 6) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strstr (foo + 1, "world") != foo + 6) - abort(); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static char * -strstr(const char *s1, const char *s2) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-10.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-10.c deleted file mode 100644 index b883dd61e01..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-10.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation. - - Ensure all expected transformations of builtin strncat occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/27/2000. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern char *strncat (char *, const char *, size_t); -extern char *strcpy (char *, const char *); -extern int strcmp (const char *, const char *); -int x = 123; - -int main () -{ - const char *const s1 = "hello world"; - const char *const s2 = ""; - char dst[64], *d2; - - strcpy (dst, s1); - if (strncat (dst, "", 100) != dst || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); - if (strncat (dst, s2, 100) != dst || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2, s2, 100) != dst+1 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, s2, 100) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, s1+11, 100) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, s1, 0) != dst+6 || d2 != dst+1 || strcmp (dst, s1)) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, "", ++x) != dst+6 || d2 != dst+1 || x != 124 - || strcmp (dst, s1)) - abort(); - - strcpy (dst, s1); - if (strncat (dst, "foo", 3) != dst || strcmp (dst, "hello worldfoo")) - abort(); - strcpy (dst, s1); - if (strncat (dst, "foo", 100) != dst || strcmp (dst, "hello worldfoo")) - abort(); - strcpy (dst, s1); - if (strncat (dst, s1, 100) != dst || strcmp (dst, "hello worldhello world")) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2, s1, 100) != dst+1 || d2 != dst+1 - || strcmp (dst, "hello worldhello world")) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, s1, 100) != dst+6 || d2 != dst+1 - || strcmp (dst, "hello worldhello world")) - abort(); - strcpy (dst, s1); d2 = dst; - if (strncat (++d2+5, s1+5, 100) != dst+6 || d2 != dst+1 - || strcmp (dst, "hello world world")) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - strcpy (dst, s1); - if (__builtin_strncat (dst, "", 100) != dst || strcmp (dst, s1)) - abort(); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static char * -strncat (char *s1, const char *s2, size_t n) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-11.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-11.c deleted file mode 100644 index 0aa186299df..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-11.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin strspn occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/27/2000. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern size_t strspn (const char *, const char *); -extern char *strcpy (char *, const char *); - -int main () -{ - const char *const s1 = "hello world"; - char dst[64], *d2; - - if (strspn (s1, "hello") != 5) - abort(); - if (strspn (s1+4, "hello") != 1) - abort(); - if (strspn (s1, "z") != 0) - abort(); - if (strspn (s1, "hello world") != 11) - abort(); - if (strspn (s1, "") != 0) - abort(); - strcpy (dst, s1); - if (strspn (dst, "") != 0) - abort(); - strcpy (dst, s1); d2 = dst; - if (strspn (++d2, "") != 0 || d2 != dst+1) - abort(); - strcpy (dst, s1); d2 = dst; - if (strspn (++d2+5, "") != 0 || d2 != dst+1) - abort(); - if (strspn ("", s1) != 0) - abort(); - strcpy (dst, s1); - if (strspn ("", dst) != 0) - abort(); - strcpy (dst, s1); d2 = dst; - if (strspn ("", ++d2) != 0 || d2 != dst+1) - abort(); - strcpy (dst, s1); d2 = dst; - if (strspn ("", ++d2+5) != 0 || d2 != dst+1) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strspn (s1, "hello") != 5) - abort(); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static size_t -strspn (const char *s1, const char *s2) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-12.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-12.c deleted file mode 100644 index 1d20f1e6708..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-12.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin strcspn occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/27/2000. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern size_t strcspn (const char *, const char *); -extern char *strcpy (char *, const char *); - -int main () -{ - const char *const s1 = "hello world"; - char dst[64], *d2; - - if (strcspn (s1, "hello") != 0) - abort(); - if (strcspn (s1, "z") != 11) - abort(); - if (strcspn (s1+4, "z") != 7) - abort(); - if (strcspn (s1, "hello world") != 0) - abort(); - if (strcspn (s1, "") != 11) - abort(); - strcpy (dst, s1); - if (strcspn (dst, "") != 11) - abort(); - strcpy (dst, s1); d2 = dst; - if (strcspn (++d2, "") != 10 || d2 != dst+1) - abort(); - strcpy (dst, s1); d2 = dst; - if (strcspn (++d2+5, "") != 5 || d2 != dst+1) - abort(); - if (strcspn ("", s1) != 0) - abort(); - strcpy (dst, s1); - if (strcspn ("", dst) != 0) - abort(); - strcpy (dst, s1); d2 = dst; - if (strcspn ("", ++d2) != 0 || d2 != dst+1) - abort(); - strcpy (dst, s1); d2 = dst; - if (strcspn ("", ++d2+5) != 0 || d2 != dst+1) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strcspn (s1, "z") != 11) - abort(); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static size_t -strcspn (const char *s1, const char *s2) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-13.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-13.c deleted file mode 100644 index 9d79ef0d817..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-13.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - - Ensure all builtin strlen comparisons against zero are optimized - and perform correctly. The multiple calls to strcpy are to prevent - the potentially "pure" strlen calls from being removed by CSE. - - Written by Roger Sayle, 11/02/2001. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern size_t strlen (const char *); -extern char *strcpy (char *, const char *); - -int -main () -{ - char str[8]; - char *ptr; - - ptr = str; - strcpy (ptr, "nts"); - if (strlen (ptr) == 0) - abort (); - - strcpy (ptr, "nts"); - if (strlen (ptr) < 1) - abort (); - - strcpy (ptr, "nts"); - if (strlen (ptr) <= 0) - abort (); - - strcpy (ptr, "nts"); - if (strlen (ptr+3) != 0) - abort (); - - strcpy (ptr, "nts"); - if (strlen (ptr+3) > 0) - abort (); - - strcpy (ptr, "nts"); - if (strlen (str+3) >= 1) - abort (); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static size_t -strlen (const char *s) -{ - abort (); -} -#endif - diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-14.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-14.c deleted file mode 100644 index cb0bfcb9dff..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-14.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - - Ensure builtin memset and memcpy are optimized away correctly. - - Written by Roger Sayle, 11/23/2001. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern void *memset (void *s, int c, size_t n); -extern void *memcpy (void *dest, const void *src, size_t n); - -char dst[32]; -char src[32]; - -int -main () -{ - memset (src, 0, 0); - memcpy (dst, src, 0); - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ - -__attribute__ ((noinline)) -static void * -memset (void *s, int c, size_t n) -{ - abort (); -} - -__attribute__ ((noinline)) -static void * -memcpy (void *dest, const void *src, size_t n) -{ - abort (); -} -#endif - diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-15.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-15.c deleted file mode 100644 index 2cf73da151c..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-15.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation. - - Ensure that short builtin memcmp are optimized and perform correctly. - On architectures with a cmpstrsi instruction, this test doesn't determine - which optimization is being performed, but it does check for correctness. - - Written by Roger Sayle, 12/02/2001. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern int memcmp (const void *, const void *, size_t); -extern char *strcpy (char *, const char *); - -int -main () -{ - char str[8]; - - strcpy (str, "3141"); - - if ( memcmp (str, str+2, 0) != 0 ) - abort (); - if ( memcmp (str+1, str+3, 0) != 0 ) - abort (); - - if ( memcmp (str+1, str+3, 1) != 0 ) - abort (); - if ( memcmp (str, str+2, 1) >= 0 ) - abort (); - if ( memcmp (str+2, str, 1) <= 0 ) - abort (); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static int -memcmp (const char *p1, const char *p2, size_t len) -{ - abort (); -} -#endif - diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-16.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-16.c deleted file mode 100644 index 8556b8f6517..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-16.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation. - - Test sprintf optimizations don't break anything and return the - correct results. - - Written by Roger Sayle, June 22, 2003. */ - -static char buffer[32]; - -extern void abort (); -typedef __SIZE_TYPE__ size_t; -extern int sprintf(char*, const char*, ...); -extern void *memset(void*, int, size_t); -extern int memcmp(const void*, const void*, size_t); - -void test1() -{ - sprintf(buffer,"foo"); -} - -int test2() -{ - return sprintf(buffer,"foo"); -} - -void test3() -{ - sprintf(buffer,"%s","bar"); -} - -int test4() -{ - return sprintf(buffer,"%s","bar"); -} - -void test5(char *ptr) -{ - sprintf(buffer,"%s",ptr); -} - - -int main() -{ - memset (buffer, 'A', 32); - test1 (); - if (memcmp(buffer, "foo", 4) || buffer[4] != 'A') - abort (); - - memset (buffer, 'A', 32); - if (test2 () != 3) - abort (); - if (memcmp(buffer, "foo", 4) || buffer[4] != 'A') - abort (); - - memset (buffer, 'A', 32); - test3 (); - if (memcmp(buffer, "bar", 4) || buffer[4] != 'A') - abort (); - - memset (buffer, 'A', 32); - if (test4 () != 3) - abort (); - if (memcmp(buffer, "bar", 4) || buffer[4] != 'A') - abort (); - - memset (buffer, 'A', 32); - test5 ("barf"); - if (memcmp(buffer, "barf", 5) || buffer[5] != 'A') - abort (); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static int -sprintf (char *buf, const char *fmt, ...) -{ - abort (); -} -#endif - diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-2.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-2.c deleted file mode 100644 index d8ebb77be51..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-2.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin strpbrk occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/6/2000. */ - -extern void abort(void); -extern char *strpbrk (const char *, const char *); -extern int strcmp (const char *, const char *); - -void fn (const char *foo, const char *const *bar) -{ - if (strcmp(strpbrk ("hello world", "lrooo"), "llo world") != 0) - abort(); - if (strpbrk (foo, "") != 0) - abort(); - if (strpbrk (foo + 4, "") != 0) - abort(); - if (strpbrk (*bar--, "") != 0) - abort(); - if (strpbrk (*bar, "h") != foo) - abort(); - if (strpbrk (foo, "h") != foo) - abort(); - if (strpbrk (foo, "w") != foo + 6) - abort(); - if (strpbrk (foo + 6, "o") != foo + 7) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strpbrk (foo + 6, "o") != foo + 7) - abort(); -} - -int main() -{ - const char *const foo[] = { "hello world", "bye bye world" }; - fn (foo[0], foo + 1); - return 0; -} - - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static char * -strpbrk(const char *s1, const char *s2) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-6.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-6.c deleted file mode 100644 index c684dbd4f13..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-6.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure builtin memcpy and strcpy perform correctly. - - Written by Jakub Jelinek, 11/24/2000. */ - -extern void abort (void); -extern char *strcpy (char *, const char *); -typedef __SIZE_TYPE__ size_t; -extern void *memcpy (void *, const void *, size_t); -extern int memcmp (const void *, const void *, size_t); - -char p[32] = ""; - -int main() -{ - if (strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) - abort (); - if (strcpy (p + 16, "vwxyz" + 1) != p + 16 || memcmp (p + 16, "wxyz", 5)) - abort (); - if (strcpy (p + 1, "") != p + 1 || memcmp (p, "a\0cde", 6)) - abort (); - if (strcpy (p + 3, "fghij") != p + 3 || memcmp (p, "a\0cfghij", 9)) - abort (); - if (memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) - abort (); - if (memcpy (p + 16, "VWX" + 1, 2) != p + 16 || memcmp (p + 16, "WXyz", 5)) - abort (); - if (memcpy (p + 1, "", 1) != p + 1 || memcmp (p, "A\0CDE", 6)) - abort (); - if (memcpy (p + 3, "FGHI", 4) != p + 3 || memcmp (p, "A\0CFGHIj", 9)) - abort (); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - if (__builtin_strcpy (p, "abcde") != p || memcmp (p, "abcde", 6)) - abort (); - if (__builtin_memcpy (p, "ABCDE", 6) != p || memcmp (p, "ABCDE", 6)) - abort (); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static char * -strcpy (char *d, const char *s) -{ - abort (); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-7.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-7.c deleted file mode 100644 index 5b915d7a7d3..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-7.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation. - - Ensure all expected transformations of builtin strncpy occur and - perform correctly. - - Written by Kaveh R. Ghazi, 11/25/2000. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; -extern char *strncpy (char *, const char *, size_t); -extern int strcmp (const char *, const char *); -extern int strncmp (const char *, const char *, size_t); -extern void *memset (void *, int, size_t); - -int i; - -int main () -{ - const char *const src = "hello world"; - const char *src2; - char dst[64], *dst2; - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst, src, 4) != dst || strncmp (dst, src, 4)) - abort(); - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst+16, src, 4) != dst+16 || strncmp (dst+16, src, 4)) - abort(); - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst+32, src+5, 4) != dst+32 || strncmp (dst+32, src+5, 4)) - abort(); - - memset (dst, 0, sizeof (dst)); - dst2 = dst; - if (strncpy (++dst2, src+5, 4) != dst+1 || strncmp (dst2, src+5, 4) - || dst2 != dst+1) - abort(); - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst, src, 0) != dst || strcmp (dst, "")) - abort(); - - memset (dst, 0, sizeof (dst)); - dst2 = dst; src2 = src; - if (strncpy (++dst2, ++src2, 0) != dst+1 || strcmp (dst2, "") - || dst2 != dst+1 || src2 != src+1) - abort(); - - memset (dst, 0, sizeof (dst)); - dst2 = dst; src2 = src; - if (strncpy (++dst2+5, ++src2+5, 0) != dst+6 || strcmp (dst2+5, "") - || dst2 != dst+1 || src2 != src+1) - abort(); - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst, src, 12) != dst || strcmp (dst, src)) - abort(); - - /* Test at least one instance of the __builtin_ style. We do this - to ensure that it works and that the prototype is correct. */ - memset (dst, 0, sizeof (dst)); - if (__builtin_strncpy (dst, src, 4) != dst || strncmp (dst, src, 4)) - abort(); - - memset (dst, 0, sizeof (dst)); - if (strncpy (dst, i++ ? "xfoo" + 1 : "bar", 4) != dst - || strcmp (dst, "bar") - || i != 1) - abort (); - - return 0; -} - -#ifdef __OPTIMIZE__ -/* When optimizing, all the above cases should be transformed into - something else. So any remaining calls to the original function - should abort. */ -__attribute__ ((noinline)) -static char * -strncpy(char *s1, const char *s2, size_t n) -{ - abort(); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c b/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c index 434de33db9b..2316fce87ca 100644 --- a/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/string-opt-8.c @@ -65,7 +65,7 @@ int main () s2 = s1; s3 = s1+4; if (strncmp (++s2, ++s3+2, 1) >= 0 || s2 != s1+1 || s3 != s1+5) abort(); -#if !defined(__OPTIMIZE__) || defined(__i386__) +#if !defined(__OPTIMIZE__) || (defined(__i386__) && !defined(__OPTIMIZE_SIZE__)) /* These tests work on platforms which support cmpstrsi. We test it at -O0 on all platforms to ensure the strncmp logic is correct. */ s2 = s1; diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c deleted file mode 100644 index c8fdaf0f95c..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-24.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Varargs and vectors! */ - -#include <stdarg.h> - -#define vector __attribute__((vector_size(16))) - -const vector unsigned int v1 = {10,11,12,13}; -const vector unsigned int v2 = {20,21,22,23}; - -void foo(int a, ...) -{ - va_list args; - vector unsigned int v; - - va_start (args, a); - v = va_arg (args, vector unsigned int); - if (a != 1 || memcmp (&v, &v1, sizeof (v)) != 0) - abort (); - a = va_arg (args, int); - if (a != 2) - abort (); - v = va_arg (args, vector unsigned int); - if (memcmp (&v, &v2, sizeof (v) != 0)) - abort (); - va_end (args); -} - -int main(void) -{ - foo (1, (vector unsigned int){10,11,12,13}, 2, - (vector unsigned int){14,15,16,17}); - return 0; -} - diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-25.x b/gcc/testsuite/gcc.c-torture/execute/va-arg-25.x index fe8d7f918f2..1658fbcc8ca 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-25.x +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-25.x @@ -1,12 +1,13 @@ -# With -Os we default to -mpreferred-stack-boundary=2, which is not -# enough for proper operation with V4SImode when the architecture -# default enables SSE. Arguably setting -mpreferred-stack-boundary=2 -# under this condition is incorrect. Finding the correct set of -# options such that we don't exchange a FAIL for an XPASS is hard; -# simply force the stack boundary we need and forget about it for now. +# This doesn't work on sparc*-*-*. -if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { - set additional_flags "-mpreferred-stack-boundary=4" +set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "PR target/12916" \ + { "sparc*-*-*" } \ + { "*" } \ + { "" } + } } return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c index 51f91d6ad46..7e90cc08f5e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.c @@ -1,6 +1,7 @@ +/* { dg-options "-finput-charset=utf-8" } */ typedef __WCHAR_TYPE__ wchar_t; -wchar_t x[] = L"Ä"; -wchar_t y = L'Ä'; +wchar_t x[] = L"Ä"; +wchar_t y = L'Ä'; extern void abort (void); extern void exit (int); @@ -8,9 +9,9 @@ int main (void) { if (sizeof (x) / sizeof (wchar_t) != 2) abort (); - if (x[0] != L'Ä' || x[1] != L'\0') + if (x[0] != L'Ä' || x[1] != L'\0') abort (); - if (y != L'Ä') + if (y != L'Ä') abort (); exit (0); } diff --git a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.x b/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.x deleted file mode 100644 index 38c693d2f00..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/wchar_t-1.x +++ /dev/null @@ -1,3 +0,0 @@ -# Doesn't compile due to use of literal ISO8859.1 characters. PR 11439. -set torture_compile_xfail "*-*-*" -return 0 diff --git a/gcc/testsuite/gcc.c-torture/unsorted/call386.c b/gcc/testsuite/gcc.c-torture/unsorted/call386.c index 18498932c5b..c82a3be3450 100644 --- a/gcc/testsuite/gcc.c-torture/unsorted/call386.c +++ b/gcc/testsuite/gcc.c-torture/unsorted/call386.c @@ -1,7 +1,6 @@ +void foo () {} -foo () {} - -main () +int main () { int i; for (i = 100000; i >= 0; i--) @@ -17,4 +16,5 @@ main () foo (); foo (); } + return 0; } diff --git a/gcc/testsuite/gcc.c-torture/unsorted/ext.c b/gcc/testsuite/gcc.c-torture/unsorted/ext.c index 8fa8cd73363..9e8604ef2b2 100644 --- a/gcc/testsuite/gcc.c-torture/unsorted/ext.c +++ b/gcc/testsuite/gcc.c-torture/unsorted/ext.c @@ -1,3 +1,12 @@ +/* The bit-field below would have a problem if __INT_MAX__ is too + small. */ +#if __INT_MAX__ < 2147483647 +int +main (void) +{ + exit (0); +} +#else struct foo { unsigned b31 : 1; @@ -11,3 +20,4 @@ foo(a) { return a.b30; } +#endif diff --git a/gcc/testsuite/gcc.c-torture/unsorted/subcc.c b/gcc/testsuite/gcc.c-torture/unsorted/subcc.c index d50114eee42..d89b50dbdff 100644 --- a/gcc/testsuite/gcc.c-torture/unsorted/subcc.c +++ b/gcc/testsuite/gcc.c-torture/unsorted/subcc.c @@ -1,4 +1,4 @@ -foo (a, c) +int foo (a, c) { int b; @@ -7,7 +7,8 @@ foo (a, c) return 0; } -bar (a) +void bar (a) + int a; { if (foo (a, 10) & 0x80000000) printf ("y"); @@ -15,7 +16,7 @@ bar (a) printf ("n"); } -main () +int main () { bar (0); bar (1); @@ -28,4 +29,5 @@ main () bar (-0x7fffffff); puts (""); + return 0; } |