diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030707-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030708-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030725-1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030804-1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030821-1.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030903-1.c | 33 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030904-1.c | 94 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030907-1.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20030921-1.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/mangle-1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/mipscop-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/mipscop-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/mipscop-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/mipscop-4.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c | 2 |
15 files changed, 245 insertions, 4 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030707-1.c b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c new file mode 100644 index 00000000000..8ce964512bf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030707-1.c @@ -0,0 +1,13 @@ +/* PR c/11449. */ + +/* sign_bit_p() in fold-const.c failed to notice that (int) 0x80000000 + was the sign bit of m. As a result, fold_single_bit_test() + returned ((unsigned int) m >> 31), and that was eventually passed + to invert_truthvalue(), which did not know how to handle + RROTATE_EXPR, causing an ICE. */ + +int +foo (int m) +{ + return !(m & ((int) 0x80000000)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030708-1.c b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c new file mode 100644 index 00000000000..5a693d8f75c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030708-1.c @@ -0,0 +1,13 @@ +/* PR 10795. */ + +/* ix86_expand_carry_flag_compare() in i386.c swapped the comparison + operands without checking that the compare instruction, cmpl, would + accept the swapped operands. */ + +extern const char a[]; + +int +foo (const char *p) +{ + return (p > a) ? 0 : 2; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030725-1.c b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c new file mode 100644 index 00000000000..26f2714010e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030725-1.c @@ -0,0 +1,9 @@ +/* This testcase caused ICE on any 64-bit arch at -O2/-O3 due to + fold/extract_muldiv/convert destroying its argument. */ +int x, *y, z, *p; + +void +foo (void) +{ + p = y + (8 * (x == 1 || x == 3) + z); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030804-1.c b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c new file mode 100644 index 00000000000..189fde3cee5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030804-1.c @@ -0,0 +1,9 @@ +/* Extracted from PR middle-end/11771. */ +/* The following testcase used to ICE without -ffast-math from unbounded + recursion in fold. This was due to the logic in negate_expr_p not + matching that in negate_expr. */ + +double f(double x) { + return -(1 - x) + (x ? -(1 - x) : 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030821-1.c b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c new file mode 100644 index 00000000000..34700ae181f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030821-1.c @@ -0,0 +1,24 @@ +/* PR target/11805. */ + +/* Consider the following sequence. + + (set (cc0) + (and:HI (reg:HI 0) + (const_int 1))) + + (set (pc) + (if_then_else (le (cc0) + (const_int 0)) + (label_ref 17) + (pc))) + + On h8300, the first insn does not set the overflow flag, but the + second requires the overflow flag. As a result, when the final + wants to output the jump insn, it cannot find a test insn that + gives appropriate condition flags. */ + +unsigned char +foo (unsigned char a) +{ + return (a & 1) > 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030903-1.c b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c new file mode 100644 index 00000000000..fa4d30db6c0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030903-1.c @@ -0,0 +1,33 @@ +/* Derived from PR optimization/11700. */ +/* The compiler used to ICE during reload for m68k targets. */ + +void check_complex (__complex__ double, __complex__ double, + __complex__ double, __complex__ int); +void check_float (double, double, double, int); +extern double _Complex conj (double _Complex); +extern double carg (double _Complex __z); + +static double minus_zero; + +void +conj_test (void) +{ + check_complex (conj (({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (0.0); + __retval; })), + ({ __complex__ double __retval; + __real__ __retval = (0.0); + __imag__ __retval = (minus_zero); + __retval; }), 0, 0); +} + +void +carg_test (void) +{ + check_float (carg (({ __complex__ double __retval; + __real__ __retval = (2.0); + __imag__ __retval = (0); + __retval; })), 0, 0, 0); +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030904-1.c b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c new file mode 100644 index 00000000000..09fd015b115 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030904-1.c @@ -0,0 +1,94 @@ +struct A +{ + long a1; + double *a2; +}; + +struct B +{ + void *b1; + double b2, b3; + struct + { + int d1; + double d2; + } b4; +}; + +struct C +{ + struct A *c1; + void *c2; +}; + +long fn1 (struct A *, double); +void fn2 (void *, const char *); +double fn3 (double); +double fn4 (double); +int fn5 (void *, double, double); + +int +foo (struct B *x) +{ + struct C *e = x->b1; + struct A *f = e->c1; + long g, h, i; + double *j, k; + g = fn1 (f, 0.5 * (x->b2 + x->b3)), h = g + 1, i = f->a1; + j = f->a2, k = x->b4.d2; + fn2 (x, "something"); + if (g <= 0) + { + double l = j[2] - j[1]; + if (l > 0.0 && l <= 0.02) + k = (x->b4.d1 == 1 + ? ((1.0 / l) < 25 ? 25 : (1.0 / l)) + : fn3 ((1.0 / l) < 25 ? 25 : (1.0 / l))); + } + else + { + double m = j[h] - j[g], n = 0.0, l = 0.0; + if (g > 1) + n = j[g] - j[g - 1]; + if (h < i) + l = j[h + 1] - j[h]; + if (n > 0.02) + n = 0; + if (m > 0.02) + m = 0; + if (l > 0.02) + l = 0; + if (m < n) + { + double o = m; + m = n; + n = o; + } + if (l < n) + { + double o = l; + l = n; + n = o; + } + if (l < m) + { + double o = l; + l = m; + m = o; + } + if (n != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / m) < 25 ? 25 : (1 / m)) + : fn3 ((1 / m) < 25 ? 25 : (1 / m))); + else if (m != 0.0) + k = (x->b4.d1 == 1 + ? ((2 / (m + l)) < 25 ? 25 : (2 / (m + l))) + : fn3 ((2 / (m + l)) < 25 ? 25 : (2 / (m + l)))); + else if (l != 0.0) + k = (x->b4.d1 == 1 + ? ((1 / l) < 25 ? 25 : (1 / l)) + : fn3 ((1 / l) < 25 ? 25 : (1 / l))); + } + fn5 (e->c2, 0.5 * (x->b2 + x->b3), (x->b4.d1 == 1 ? k : fn4 (k))); + return 1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20030907-1.c b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c new file mode 100644 index 00000000000..e362b910284 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030907-1.c @@ -0,0 +1,25 @@ +/* PR 11665 + Orgin: jwhite@cse.unl.edu + The problem was in initializer_constant_valid_p, + "for a CONSTRUCTOR, only the last element + of the CONSTRUCTOR was being checked" + (from the email of the patch which fixed this). + This used to ICE because GCC thought gdt_table was a + constant value when it is not. */ + +int x; +struct gdt +{ +unsigned a,b,c,d,e,f; +}; +void f() +{ +struct gdt gdt_table[2]= +{ + { + 0, + ( (((unsigned)(&x))<<(24))&(-1<<(8)) ), + }, +}; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/20030921-1.c b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c new file mode 100644 index 00000000000..8199dc657f2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030921-1.c @@ -0,0 +1,10 @@ +/* PR 12281 The darwin back-end was causing the function + f is not being emitted. TREE_SYMBOL_REFERENCED was being set + instead of calling mark_referenced. */ + + +static void f(void); +void g(void (*x) (void)){x();} +static inline void f(void){} +void h(){g(f);} +int main(){h();return 0;} diff --git a/gcc/testsuite/gcc.c-torture/compile/mangle-1.c b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c new file mode 100644 index 00000000000..7abc934e75c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/mangle-1.c @@ -0,0 +1,9 @@ +int foo(void) +{ + static int x asm ("x") = 3; + return x++; +} + +int X2 asm ("x.0") = 4; +int X3 asm ("_x.0") = 5; + diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c index 478b423e2d7..911aec2b40c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-1.c @@ -1,4 +1,4 @@ -/* { dg-do assemble {target *mips*-*-* } } */ +/* { dg-do compile { target mips*-*-* } } */ register unsigned int cp0count asm ("$c0r1"); diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c index 0ba5610b623..1f911829325 100644 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-2.c @@ -1,4 +1,4 @@ -/* { dg-do assemble {target *mips*-*-* } } */ +/* { dg-do compile { target mips*-*-* } } */ register unsigned int c3r1 asm ("$c3r1"); diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c index 3a4250cc358..014f33541dc 100644 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-3.c @@ -1,4 +1,4 @@ -/* { dg-do assemble {target *mips*-*-* } } */ +/* { dg-do compile { target mips*-*-* } } */ register unsigned int c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); diff --git a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c index a30146224c1..da249daa6ae 100644 --- a/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c +++ b/gcc/testsuite/gcc.c-torture/compile/mipscop-4.c @@ -1,4 +1,4 @@ -/* { dg-do assemble {target *mips*-*-* } } */ +/* { dg-do compile { target mips*-*-* } } */ register unsigned long c3r1 asm ("$c3r1"), c3r2 asm ("$c3r2"); diff --git a/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c new file mode 100644 index 00000000000..0f97f7d12b2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/zero-strct-2.c @@ -0,0 +1,2 @@ +struct { } foo = { }; +void * bar(void) { return &foo; } |