aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20050423-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20050520-1.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21293.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21562.c25
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21638.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21761.c9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21839.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020720-1.x3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20050604-1.c39
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20050607-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr21331.c15
12 files changed, 184 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050423-1.c b/gcc/testsuite/gcc.c-torture/compile/20050423-1.c
new file mode 100644
index 00000000000..fee5eb9093e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20050423-1.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/20742 */
+
+int
+foo (int x, int y)
+{
+ register int a = y + 57;
+ register int b = y + 31;
+
+ while (x-- > 0)
+ {
+ #define TEN(x) x x x x x x x x x x
+ TEN (TEN (a += b; b -= a;))
+ TEN (TEN (a += b; b -= a;))
+ }
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050520-1.c b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c
new file mode 100644
index 00000000000..9e2f6c8c74b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c
@@ -0,0 +1,13 @@
+struct s { int x[4]; };
+struct s gs;
+
+void
+bar (void)
+{
+ struct s *s;
+ int i;
+
+ s = &gs;
+ for (i = 0; i < 4; i++)
+ ((char*) (&s->x[i]))[0] = 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21293.c b/gcc/testsuite/gcc.c-torture/compile/pr21293.c
new file mode 100644
index 00000000000..54184b3e039
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21293.c
@@ -0,0 +1,12 @@
+/* Testcase from Dale Johannesen <dalej@gcc.gnu.org>. */
+struct {
+double x[1];
+} g;
+void k( double *, double*);
+void h(int Tmp8)
+{
+ int i;
+ for(i = 1;i <= Tmp8;i++)
+ k(&g.x[ + -1],&g.x[ Tmp8 + -1]);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21562.c b/gcc/testsuite/gcc.c-torture/compile/pr21562.c
new file mode 100644
index 00000000000..d100b28dd45
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21562.c
@@ -0,0 +1,25 @@
+/* { dg-options "-O3 -fno-inline" } */
+struct foo { int a, b, c; };
+void abort(void);
+void exit(int);
+
+void
+brother (int a, int b, int c)
+{
+ if (a)
+ abort ();
+}
+
+void
+sister (struct foo f, int b, int c)
+{
+ brother ((f.b == b), b, c);
+}
+
+int
+main ()
+{
+ struct foo f = { 7, 8, 9 };
+ sister (f, 1, 2);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21638.c b/gcc/testsuite/gcc.c-torture/compile/pr21638.c
new file mode 100644
index 00000000000..36fd0104aeb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21638.c
@@ -0,0 +1,21 @@
+typedef struct hashhdr {
+ int bitmaps[32];
+} HASHHDR;
+
+static void
+swap_header_copy(HASHHDR *srcp, HASHHDR *destp)
+{
+ int i;
+ for (i = 0; i < 32; i++)
+ ((char *)&(destp->bitmaps[i]))[0] = ((char *)&(srcp->bitmaps[i]))[1];
+}
+
+int
+flush_meta(HASHHDR *whdrp1)
+{
+ HASHHDR *whdrp;
+ HASHHDR whdr;
+ whdrp = &whdr;
+ swap_header_copy(whdrp1, whdrp);
+ return (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21761.c b/gcc/testsuite/gcc.c-torture/compile/pr21761.c
new file mode 100644
index 00000000000..b9ca5c91965
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21761.c
@@ -0,0 +1,9 @@
+void f1()
+{
+ long bit=0, exponent;
+ exponent = -exponent;
+ for (bit = 1; exponent; bit <<= 1)
+ if (exponent & bit)
+ exponent ^= bit;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21839.c b/gcc/testsuite/gcc.c-torture/compile/pr21839.c
new file mode 100644
index 00000000000..c02085c2dfd
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21839.c
@@ -0,0 +1,12 @@
+ typedef struct { } spinlock_t;
+typedef struct {
+ unsigned sequence;
+ spinlock_t lock;
+} seqlock_t;
+void ext3_new_inode(seqlock_t *rsv_seqlock)
+{
+ *rsv_seqlock = (seqlock_t) { 0, (spinlock_t) { } };
+
+}
+
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x
index 6791a1f5d12..8d14adc2f26 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20020720-1.x
+++ b/gcc/testsuite/gcc.c-torture/execute/20020720-1.x
@@ -29,7 +29,8 @@ set torture_eval_before_compile {
set compiler_conditional_xfail_data {
"This test fails to optimize completely on certain platforms." \
{ "xtensa-*-*" "sh-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" \
- "h8300*-*-*" "frv-*-*" "powerpc*-*-*" "rs6000-*-*" "bfin*-*" } \
+ "h8300*-*-*" "frv-*-*" "powerpc*-*-*" "rs6000-*-*" "bfin*-*" \
+ "m32r*-*-*" "avr-*-*"} \
{ "*" } \
{ "-O0" }
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050604-1.c b/gcc/testsuite/gcc.c-torture/execute/20050604-1.c
new file mode 100644
index 00000000000..70097aa14cb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20050604-1.c
@@ -0,0 +1,39 @@
+/* PR regression/21897 */
+
+extern void abort (void);
+
+typedef short v4hi __attribute__ ((vector_size (8)));
+typedef float v4sf __attribute__ ((vector_size (16)));
+
+union
+{
+ v4hi v;
+ short s[4];
+} u;
+
+union
+{
+ v4sf v;
+ float f[4];
+} v;
+
+void
+foo (void)
+{
+ unsigned int i;
+ for (i = 0; i < 2; i++)
+ u.v += (v4hi) { 12, 14 };
+ for (i = 0; i < 2; i++)
+ v.v += (v4sf) { 18.0, 20.0, 22 };
+}
+
+int
+main (void)
+{
+ foo ();
+ if (u.s[0] != 24 || u.s[1] != 28 || u.s[2] || u.s[3])
+ abort ();
+ if (v.f[0] != 36.0 || v.f[1] != 40.0 || v.f[2] != 44.0 || v.f[3] != 0.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050607-1.c b/gcc/testsuite/gcc.c-torture/execute/20050607-1.c
new file mode 100644
index 00000000000..41579bbba5e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20050607-1.c
@@ -0,0 +1,16 @@
+/* PR middle-end/21850 */
+
+extern void abort (void);
+
+typedef int V2SI __attribute__ ((vector_size (8)));
+
+int
+main (void)
+{
+#if (__INT_MAX__ == 2147483647) \
+ && (__LONG_LONG_MAX__ == 9223372036854775807LL)
+ if (((int)(long long)(V2SI){ 2, 2 }) != 2)
+ abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
index ff508d3f420..64bbdad7e84 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
@@ -1,6 +1,6 @@
#
# Expect driver script for GCC Regression Tests
-# Copyright (C) 1993, 1996, 2001 Free Software Foundation
+# Copyright (C) 1993, 1996, 2001, 2005 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,6 +38,9 @@ set additional_flags ""
if [istarget "i\[34567\]86-*-*"] then {
lappend additional_flags "-ffloat-store"
}
+if { [istarget "x86_64-*-*"] && [check_effective_target_ilp32] } then {
+ lappend additional_flags "-ffloat-store"
+}
if [istarget "m68k-*-*"] then {
lappend additional_flags "-ffloat-store"
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr21331.c b/gcc/testsuite/gcc.c-torture/execute/pr21331.c
new file mode 100644
index 00000000000..4d95878e631
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr21331.c
@@ -0,0 +1,15 @@
+void abort (void);
+
+int bar (void) { return -1; }
+
+unsigned long
+foo ()
+{ unsigned long retval;
+ retval = bar ();
+ if (retval == -1) return 0;
+ return 3; }
+
+main ()
+{ if (foo () != 0) abort ();
+ return 0; }
+