aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile')
-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
7 files changed, 108 insertions, 0 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) { } };
+
+}
+
+