diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
50 files changed, 842 insertions, 46 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20000804-1.x b/gcc/testsuite/gcc.c-torture/compile/20000804-1.x index d2c3cec91a2..458c8e720e3 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20000804-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/20000804-1.x @@ -1,9 +1,8 @@ # This does not work on m68hc11 due to the use of an asm statement # to force a 'long long' (64-bits) to go in a register. -global target_triplet if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set torture_compile_xfail "$target_triplet" + return 1 } return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20001205-1.x b/gcc/testsuite/gcc.c-torture/compile/20001205-1.x index bde61fd93da..134cdf109fe 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001205-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/20001205-1.x @@ -1,8 +1,7 @@ # This does not work on m68hc11 due to the asm statement which # forces two 'long' (32-bits) variables to go in registers. -global target_triplet if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set torture_compile_xfail "$target_triplet" + return 1 } return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.x b/gcc/testsuite/gcc.c-torture/compile/20001226-1.x index 13616c69f37..6e46f46724e 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.x @@ -3,7 +3,7 @@ global target_triplet if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set torture_compile_xfail "$target_triplet" + return 1 } # It doesn't work on Xtensa with -O0 because the function is larger diff --git a/gcc/testsuite/gcc.c-torture/compile/20010518-2.x b/gcc/testsuite/gcc.c-torture/compile/20010518-2.x index 4cfce33b2dc..1bd6f8fd464 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010518-2.x +++ b/gcc/testsuite/gcc.c-torture/compile/20010518-2.x @@ -1,2 +1,8 @@ -set options "-S" +# This test fails on HC11/HC12 when it is compiled without -mshort because +# the array is too large (INT_MAX/2 > 64K). Force to use 16-bit ints for it. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + set options "-S -mshort" +} else { + set options "-S" +} return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20020312-1.x b/gcc/testsuite/gcc.c-torture/compile/20020312-1.x new file mode 100644 index 00000000000..105f2516474 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20020312-1.x @@ -0,0 +1,6 @@ +# This does not compile on HC11/HC12 due to the asm which requires +# two 32-bit registers. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.x b/gcc/testsuite/gcc.c-torture/compile/20020604-1.x index 4d4a49ef9e0..bced22f0f44 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.x @@ -3,4 +3,8 @@ if { [istarget "h8300-*-*"] } { return 1; } +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + return 1; +} + return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-1.c b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c new file mode 100644 index 00000000000..789b8a8b176 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-1.c @@ -0,0 +1,12 @@ +/* PR target/7370. */ + +int g (int *x, int *y); + +void f () +{ + int x, y; + char a[4000]; + + g (&x, &y); + x = x/y + x; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20021015-2.c b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c new file mode 100644 index 00000000000..6b158c5bdc8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021015-2.c @@ -0,0 +1,7 @@ +/* PR target/8232. */ + +int f (char *p, char *q, int i) +{ + return bcmp (p, q, i); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20021123-1.c b/gcc/testsuite/gcc.c-torture/compile/20021123-1.c new file mode 100644 index 00000000000..dd2aa7e09dd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021123-1.c @@ -0,0 +1,10 @@ +/* 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 new file mode 100644 index 00000000000..423f8ec1964 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021123-2.c @@ -0,0 +1,9 @@ +/* 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 new file mode 100644 index 00000000000..51f0e257dfd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021123-3.c @@ -0,0 +1,9 @@ +/* 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 new file mode 100644 index 00000000000..d4306b89b99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021123-4.c @@ -0,0 +1,11 @@ +/* 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/20030110-1.c b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c new file mode 100644 index 00000000000..1cbbaea3c10 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030110-1.c @@ -0,0 +1,39 @@ +extern char bpp; + +void foo() +{ + if (bpp == 32) + { + if (2 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2 +1))); + } + while(0); + } + else + { + do + { + while (inb(0x9ae8) & (0x0100 >> (2))); + } + while(0); + } + } + else + do + { + while (inb(0x9ae8) & (0x0100 >> (1))); + } + while(0); + if (8 < 8) + { + do + { + while (inb(0x9ae8) & (0x0100 >> (8 +1))); + } + while(0); + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030125-1.c b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c new file mode 100644 index 00000000000..656304e2d67 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030125-1.c @@ -0,0 +1,24 @@ + int count; + + int func(int *valp) { + int val, locked = 0; + + while ((val = *valp) != 0) { + if (count) { + if (count) + locked = 1; + else + locked = 1; + + if (!locked) + continue; + } + + if (!count) + count--; + + break; + } + + return val; + } diff --git a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c new file mode 100644 index 00000000000..1e0d5445877 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c @@ -0,0 +1,14 @@ +/* PR c/9530 */ +/* Contributed by Volker Reichelt. */ + +/* Verify that the call to 'foo' is not turned + into a sibling call. */ + +void foo(float d); + +float bar(float d); + +float baz(float d) +{ + foo(bar(d)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030219-1.c b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c new file mode 100644 index 00000000000..ecc943f7737 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030219-1.c @@ -0,0 +1,6 @@ +int global_one; + +void clobber_register() +{ + *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030305-1.c b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c new file mode 100644 index 00000000000..2f608196fdd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030305-1.c @@ -0,0 +1,18 @@ +/* PR c/9799 */ +/* Verify that GCC doesn't crash on excess elements + in initializer for a flexible array member. */ + +typedef struct { + int aaa; +} s1_t; + +typedef struct { + int bbb; + s1_t s1_array[]; +} s2_t; + +static s2_t s2_array[]= { + { 1, 4 }, + { 2, 5 }, + { 3, 6 } +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c new file mode 100644 index 00000000000..02d4fed526a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8396 */ +/* Originator: <papadopo@shfj.cea.fr> */ + +/* Verify that the tree inliner doesn't mess up the types + when passing the value of read-only constant arguments. */ + +static inline bar(const short int xs, const short int xe) +{ + if (xe && (xs < xe)) + ; +} + +void f() +{ + short int xe; + + bar(0, xe); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030330-1.c b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c new file mode 100644 index 00000000000..a5d5de23b7a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030330-1.c @@ -0,0 +1,7 @@ +/* PR c/10083 */ +/* This will result in a very small constant for umul_highpart, which + uncovered a bug in the Alpha machine description. */ + +unsigned long f(unsigned long x) { + return x % 0x3fffffffffffffff; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c new file mode 100644 index 00000000000..2e61f1fa3ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c @@ -0,0 +1,58 @@ +/* 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) +{ + if (y == 0) + { + *allegro_errno = 34; + return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF; + } + 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))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030418-1.c b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c new file mode 100644 index 00000000000..f6d5a4af51c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030418-1.c @@ -0,0 +1,16 @@ +/* PR optimization/7675 */ +/* Contributed by Volker Reichelt */ + +/* Verify that we don't put automatic variables + in registers too early. */ + +extern int dummy (int *); + +void foo(int i) +{ + int j=i; + + void bar() { int x=j, y=i; } + + dummy(&i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030604-1.c b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c new file mode 100644 index 00000000000..7e36bfeb39e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030604-1.c @@ -0,0 +1,18 @@ +/* PR optimization/10876 */ +/* Contributed by Christian Ehrhardt */ + +/* Verify that the SPARC port doesn't emit + (minus) (reg) (const_int) insns. */ + +void f(void) +{ + unsigned int butterfly, block, offset; + double *Z; + + for (block = 0; block < 512; block += 512) { + double T1re, T2re; + offset = butterfly + block; + T1re += T2re; + T2re = Z[offset] + T1re; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030625-1.c b/gcc/testsuite/gcc.c-torture/compile/20030625-1.c new file mode 100644 index 00000000000..e6b0be9af31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030625-1.c @@ -0,0 +1 @@ +void foo (const char *s, ...) { bar (&s); } diff --git a/gcc/testsuite/gcc.c-torture/compile/20030703-1.c b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c new file mode 100644 index 00000000000..4b45f5e574b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030703-1.c @@ -0,0 +1,10 @@ +/* Extracted from PR target/10700. */ +/* The following code used to cause an ICE on 64-bit targets. */ + +int SAD_Block(int *); +void MBMotionEstimation(int *act_block, int block) +{ + SAD_Block(act_block + ( (8 * (block == 1 || block == 3)) + + (8 * (block == 2 || block == 3)))); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-12.x b/gcc/testsuite/gcc.c-torture/compile/920501-12.x new file mode 100644 index 00000000000..61ba34933fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-12.x @@ -0,0 +1,6 @@ +# This test fails on HC11/HC12 when it is compiled without -mshort because +# the stack arrays are too large. Force to use 16-bit ints for it. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + set options "-mshort" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920501-4.x b/gcc/testsuite/gcc.c-torture/compile/920501-4.x new file mode 100644 index 00000000000..cf60af9be67 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/920501-4.x @@ -0,0 +1,6 @@ +# This test fails on HC11/HC12 when it is compiled without -mshort because +# the 'r0' array is too large. Force to use 16-bit ints for it. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + set options "-mshort" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/920520-1.x b/gcc/testsuite/gcc.c-torture/compile/920520-1.x index f7a13c87abc..3687bf6145d 100644 --- a/gcc/testsuite/gcc.c-torture/compile/920520-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/920520-1.x @@ -3,8 +3,7 @@ set options "-S" # This does not work on m68hc11 due to the asm which forces a # float or a double to go in a register. -global target_triplet if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { - set torture_compile_xfail "$target_triplet" + return 1 } return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/961203-1.x b/gcc/testsuite/gcc.c-torture/compile/961203-1.x index e6fd4e41a70..e705ffe167a 100644 --- a/gcc/testsuite/gcc.c-torture/compile/961203-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/961203-1.x @@ -10,9 +10,8 @@ if { [istarget "h8300-*-*"] } { # Array 'a' in this test is too large to fit in 64K. -global target_triplet if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} { - set torture_compile_xfail "$target_triplet" + return 1 } return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/980506-1.x b/gcc/testsuite/gcc.c-torture/compile/980506-1.x index 056ef463835..133ed24d944 100644 --- a/gcc/testsuite/gcc.c-torture/compile/980506-1.x +++ b/gcc/testsuite/gcc.c-torture/compile/980506-1.x @@ -7,4 +7,7 @@ if { [istarget "h8300-*-*"] } { return 1; } +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + return 1 +} return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-5.x b/gcc/testsuite/gcc.c-torture/compile/simd-5.x index b7612f78787..ada37b18652 100644 --- a/gcc/testsuite/gcc.c-torture/compile/simd-5.x +++ b/gcc/testsuite/gcc.c-torture/compile/simd-5.x @@ -1,6 +1,41 @@ # h8300 does not have long long if { [istarget "h8300-*-*"] } { - return 1; + return 1; +} + +if { [istarget "sparc64-*-*"] || [istarget "sparcv9-*-*"] } { + # On SPARC64/SPARC-V9 it fails, except with -m32. + set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "PR target/9200" \ + { "*-*-*" } \ + { "*" } \ + { "-m32" } + } + } +} elseif { [istarget "sparc-*-*"] } { + # On regular SPARC it doesn't fail, except with -m64. + set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "PR target/9200" \ + { "*-*-*" } \ + { "-m64" } \ + { "" } + } + } +} elseif { [istarget "powerpc64-*-*"] } { + # On PowerPC-64 it fails unconditionally. + set torture_eval_before_compile { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "PR target/9680" \ + "*-*-*" \ + { "*" } \ + { "" } + } + } } return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20011126-1.c b/gcc/testsuite/gcc.c-torture/execute/20011126-1.c index 6c54043a458..ede938b0042 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20011126-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20011126-1.c @@ -1,19 +1,19 @@ -/* Produced a overflow in ifcvt.c, causing S to contain 0xffffffff7fffffff. */
-
-int a = 1;
-
-int main ()
-{
- long long s;
-
- s = a;
- if (s < 0)
- s = -2147483648LL;
- else
- s = 2147483647LL;
-
- if (s < 0)
- abort ();
-
- return 0;
-}
+/* Produced a overflow in ifcvt.c, causing S to contain 0xffffffff7fffffff. */ + +int a = 1; + +int main () +{ + long long s; + + s = a; + if (s < 0) + s = -2147483648LL; + else + s = 2147483647LL; + + if (s < 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20020227-1.x b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x index 3c3c4bb9cb5..72adedff865 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20020227-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20020227-1.x @@ -2,20 +2,34 @@ # been observed to fail on at least mips-irix6, alpha, ia64, hppa64, # sparc64/sparcv9 and mmix during April 2002. -if { [istarget "*64*-*-*"] || [istarget "alpha*-*-*"] || [istarget "mmix-*-*"] - || [istarget "sparcv9-*-*"] || [istarget "mips*-*-irix6*"] } { - set torture_execute_xfail [istarget] -} - -# Regular sparc- also fails with -m64. -set torture_eval_before_execute { - global compiler_conditional_xfail_data - set compiler_conditional_xfail_data { - "This test fails on 64-bit targets, see PR6221." \ - { "sparc-*-*" } \ - { "-m64" } \ - { "" } +if { [istarget "sparc64-*-*"] || [istarget "sparcv9-*-*"] } { + # On sparc64/sparcv9 it doesn't fail at -O0/-O1, or at all with -m32. + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "This test fails on 64-bit targets, see PR6221." \ + { "*-*-*" } \ + { "-O2" "-O3" "-Os" } \ + { "-m32" } + } } +} elseif { [istarget "sparc-*-*"] } { + # Regular sparc fails with -m64, but not with -O0/-O1. + set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "This test fails on 64-bit targets, see PR6221." \ + { "*-*-*" } \ + { "-m64" } \ + { "-O0" "-O1" } + } + } +} elseif { [istarget "powerpc64-*-*"] } { + # PowerPC-64 doesn't fail at any optimization level. +} elseif { [istarget "*64*-*-*"] || [istarget "alpha*-*-*"] + || [istarget "mmix-*-*"] || [istarget "mips*-*-irix6*"] } { + # Other 64-bit targets fail at all optimization levels. + set torture_execute_xfail [istarget] } return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x index ce0dd0033cb..58e311c0d3c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x @@ -15,7 +15,8 @@ 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*-*-*" } \ + { "xtensa-*-*" "sh-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" \ + "h8300*-*-*" "x86_64-*-*" "cris-*-*" } \ { "*" } \ { "-O0" } } diff --git a/gcc/testsuite/gcc.c-torture/execute/20021024-1.c b/gcc/testsuite/gcc.c-torture/execute/20021024-1.c new file mode 100644 index 00000000000..f7d98e929a2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021024-1.c @@ -0,0 +1,43 @@ +/* Origin: PR target/6981 from Mattias Engdegaard <mattias@virtutech.se>. */ + +void exit (int); +void abort (void); + +unsigned long long *cp, m; + +void foo (void) +{ +} + +void bar (unsigned rop, unsigned long long *r) +{ + unsigned rs1, rs2, rd; + +top: + rs2 = (rop >> 23) & 0x1ff; + rs1 = (rop >> 9) & 0x1ff; + rd = rop & 0x1ff; + + *cp = 1; + m = r[rs1] + r[rs2]; + *cp = 2; + foo(); + if (!rd) + goto top; + r[rd] = 1; +} + +int main(void) +{ + static unsigned long long r[64]; + unsigned long long cr; + cp = &cr; + + r[4] = 47; + r[8] = 11; + bar((8 << 23) | (4 << 9) | 15, r); + + if (m != 47 + 11) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20021219-1.c b/gcc/testsuite/gcc.c-torture/execute/20021219-1.c new file mode 100644 index 00000000000..2e658a5a885 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20021219-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8988 */ +/* Contributed by Kevin Easton */ + +void foo(char *p1, char **p2) +{} + +int main(void) +{ + char str[] = "foo { xx }"; + char *ptr = str + 5; + + foo(ptr, &ptr); + + while (*ptr && (*ptr == 13 || *ptr == 32)) + ptr++; + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030109-1.c b/gcc/testsuite/gcc.c-torture/execute/20030109-1.c new file mode 100644 index 00000000000..1bea931f64c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030109-1.c @@ -0,0 +1,20 @@ +/* PR c/8032 */ +/* Verify that an empty initializer inside a partial + parent initializer doesn't confuse GCC. */ + +struct X +{ + int a; + int b; + int z[]; +}; + +struct X x = { .b = 40, .z = {} }; + +int main () +{ + if (x.b != 40) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030120-1.c b/gcc/testsuite/gcc.c-torture/execute/20030120-1.c new file mode 100644 index 00000000000..0ac0ecf7025 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030120-1.c @@ -0,0 +1,50 @@ +/* On H8/300 port, NOTICE_UPDATE_CC had a bug that causes the final + pass to remove test insns that should be kept. */ + +unsigned short +test1 (unsigned short w) +{ + if ((w & 0xff00) == 0) + { + if (w == 0) + w = 2; + } + return w; +} + +unsigned long +test2 (unsigned long w) +{ + if ((w & 0xffff0000) == 0) + { + if (w == 0) + w = 2; + } + return w; +} + +int +test3 (unsigned short a) +{ + if (a & 1) + return 1; + else if (a) + return 1; + else + return 0; +} + +int +main () +{ + if (test1 (1) != 1) + abort (); + + if (test2 (1) != 1) + abort (); + + if (test3 (2) != 1) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030120-2.c b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c new file mode 100644 index 00000000000..298bc4f5b4f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030120-2.c @@ -0,0 +1,19 @@ +/* PR 8848 */ + +extern void abort (); + +int foo(int status) +{ + int s = 0; + if (status == 1) s=1; + if (status == 3) s=3; + if (status == 4) s=4; + return s; +} + +int main() +{ + if (foo (3) != 3) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030218-1.c b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c new file mode 100644 index 00000000000..8dde79451fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030218-1.c @@ -0,0 +1,25 @@ +/* On H8, the predicate general_operand_src(op,mode) used to ignore + mode when op is a (mem (post_inc ...)). As a result, the pattern + for extendhisi2 was recognized as extendqisi2. */ + +extern void abort (); +extern void exit (int); + +short *q; + +long +foo (short *p) +{ + long b = *p; + q = p + 1; + return b; +} + +int +main () +{ + short a = 0xff00; + if (foo (&a) != (long) (short) 0xff00) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030221-1.c b/gcc/testsuite/gcc.c-torture/execute/20030221-1.c new file mode 100644 index 00000000000..9dcee3e2338 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030221-1.c @@ -0,0 +1,17 @@ +/* PR optimization/8613 */ +/* Contributed by Glen Nakamura */ + +extern void abort (void); + +int main (void) +{ + char buf[16] = "1234567890"; + char *p = buf; + + *p++ = (char) __builtin_strlen (buf); + + if ((buf[0] != 10) || (p - buf != 1)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030224-2.c b/gcc/testsuite/gcc.c-torture/execute/20030224-2.c new file mode 100644 index 00000000000..5b692fb4669 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030224-2.c @@ -0,0 +1,28 @@ +/* Make sure that we don't free any temp stack slots associated with + initializing marker before we're finished with them. */ + +extern void abort(); + +typedef struct { short v16; } __attribute__((packed)) jint16_t; + +struct node { + jint16_t magic; + jint16_t nodetype; + int totlen; +} __attribute__((packed)); + +struct node node, *node_p = &node; + +int main() +{ + struct node marker = { + .magic = (jint16_t) {0x1985}, + .nodetype = (jint16_t) {0x2003}, + .totlen = node_p->totlen + }; + if (marker.magic.v16 != 0x1985) + abort(); + if (marker.nodetype.v16 != 0x2003) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030307-1.c b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c new file mode 100644 index 00000000000..3f4eb864d6c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030307-1.c @@ -0,0 +1,26 @@ +/* PR optimization/8726 */ +/* Originator: Paul Eggert <eggert@twinsun.com> */ + +/* Verify that GCC doesn't miscompile tail calls on Sparc. */ + +extern void abort(void); + +int fcntl_lock(int fd, int op, long long offset, long long count, int type); + +int vfswrap_lock(char *fsp, int fd, int op, long long offset, long long count, int type) +{ + return fcntl_lock(fd, op, offset, count, type); +} + +int fcntl_lock(int fd, int op, long long offset, long long count, int type) +{ + return type; +} + +int main(void) +{ + if (vfswrap_lock (0, 1, 2, 3, 4, 5) != 5) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030313-1.c b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c new file mode 100644 index 00000000000..49245a0b39f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030313-1.c @@ -0,0 +1,68 @@ +struct A +{ + unsigned long p, q, r, s; +} x = { 13, 14, 15, 16 }; + +extern void abort (void); +extern void exit (int); + +static inline struct A * +bar (void) +{ + struct A *r; + + switch (8) + { + case 2: + abort (); + break; + case 8: + r = &x; + break; + default: + abort (); + break; + } + return r; +} + +void +foo (unsigned long *x, int y) +{ + if (y != 12) + abort (); + if (x[0] != 1 || x[1] != 11) + abort (); + if (x[2] != 2 || x[3] != 12) + abort (); + if (x[4] != 3 || x[5] != 13) + abort (); + if (x[6] != 4 || x[7] != 14) + abort (); + if (x[8] != 5 || x[9] != 15) + abort (); + if (x[10] != 6 || x[11] != 16) + abort (); +} + +int +main (void) +{ + unsigned long a[40]; + int b = 0; + + a[b++] = 1; + a[b++] = 11; + a[b++] = 2; + a[b++] = 12; + a[b++] = 3; + a[b++] = bar()->p; + a[b++] = 4; + a[b++] = bar()->q; + a[b++] = 5; + a[b++] = bar()->r; + a[b++] = 6; + a[b++] = bar()->s; + foo (a, b); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030316-1.c b/gcc/testsuite/gcc.c-torture/execute/20030316-1.c new file mode 100644 index 00000000000..bde2e136ad3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030316-1.c @@ -0,0 +1,12 @@ +/* PR target/9164 */ +/* The comparison operand was sign extended erraneously. */ + +int +main (void) +{ + long j = 0x40000000; + if ((unsigned int) (0x40000000 + j) < 0L) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20030613-1.c b/gcc/testsuite/gcc.c-torture/execute/20030613-1.c new file mode 100644 index 00000000000..cb1623d9617 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030613-1.c @@ -0,0 +1,62 @@ +/* PR optimization/10955 */ +/* Originator: <heinrich.brand@fujitsu-siemens.com> */ + +/* This used to fail on SPARC32 at -O3 because the loop unroller + wrongly thought it could eliminate a pseudo in a loop, while + the pseudo was used outside the loop. */ + +extern void abort(void); + +#define COMPLEX struct CS + +COMPLEX { + long x; + long y; +}; + + +static COMPLEX CCID (COMPLEX x) +{ + COMPLEX a; + + a.x = x.x; + a.y = x.y; + + return a; +} + + +static COMPLEX CPOW (COMPLEX x, int y) +{ + COMPLEX a; + a = x; + + while (--y > 0) + a=CCID(a); + + return a; +} + + +static int c5p (COMPLEX x) +{ + COMPLEX a,b; + a = CPOW (x, 2); + b = CCID( CPOW(a,2) ); + + return (b.x == b.y); +} + + +int main (void) +{ + COMPLEX x; + + x.x = -7; + x.y = -7; + + if (!c5p(x)) + abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/960312-1.x b/gcc/testsuite/gcc.c-torture/execute/960312-1.x new file mode 100644 index 00000000000..ed4bac41066 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/960312-1.x @@ -0,0 +1,7 @@ +# This test fails on HC11/HC12 when it is compiled without -mshort because +# is uses an asm that requires two 32-bit registers (int). It passes +# when using -mshort because there are enough registers; force -mshort. +if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { + set options "-mshort" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x new file mode 100644 index 00000000000..f1a6be7f02e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.x @@ -0,0 +1,11 @@ +set torture_eval_before_execute { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data { + "This test fails on all targets when optimizing." \ + { "*-*-*" } \ + { "*" } \ + { "-O0" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c index ed266efdd86..5f1768c1abc 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c @@ -49,7 +49,7 @@ int main() exit (0); c(0x3690000000000000ULL, 0x00000000U); -#if (defined __arm__ || defined __thumb__) && ! defined __ARMEB__ +#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__) /* The ARM always stores FP numbers in big-wordian format, even when running in little-byteian mode. */ c(0x0000000136900000ULL, 0x00000001U); diff --git a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c b/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c index dbdc812fe6b..63708408235 100644 --- a/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/stdio-opt-1.c @@ -54,7 +54,7 @@ int main() return 0; } -#ifdef __OPTIMIZE__ +#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. */ diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c new file mode 100644 index 00000000000..89a11cf9f73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-23.c @@ -0,0 +1,26 @@ +/* PR 9700 */ +/* Alpha got the base address for the va_list incorrect when there was + a structure that was passed partially in registers and partially on + the stack. */ + +#include <stdarg.h> + +struct two { long x, y; }; + +void foo(int a, int b, int c, int d, int e, struct two f, int g, ...) +{ + va_list args; + int h; + + va_start(args, g); + h = va_arg(args, int); + if (g != 1 || h != 2) + abort (); +} + +int main() +{ + struct two t = { 0, 0 }; + foo(0, 0, 0, 0, 0, t, 1, 2); + return 0; +} |