+2002-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20010226-1.c: New test.
+ * gcc.c-torture/compile/20010227-1.c: New test.
+ * gcc.c-torture/compile/20010426-1.c: New test.
+ * gcc.c-torture/compile/20010510-1.c: New test.
+ * gcc.c-torture/compile/20010605-3.c: New test.
+ * gcc.c-torture/compile/20010824-1.c: New test.
+ * gcc.c-torture/execute/20010409-1.c: New test.
+ * gcc.dg/noncompile/20000901-1.c: New test.
+ * gcc.dg/20001023-1.c: New test.
+ * gcc.dg/20001101-1.c: New test.
+ * gcc.dg/20001102-1.c: New test.
+ * gcc.dg/20010207-1.c: New test.
+ * gcc.dg/20010405-1.c: New test.
+ * gcc.dg/20010822-1.c: New test.
+ * gcc.dg/20011107-1.c: New test.
+
Wed Jan 9 14:03:20 2002 Jeffrey A Law (law@redhat.com)
* gcc.c-torture/execute/strct-stdarg-1.x: New file. Expect
--- /dev/null
+void f1 (void *);
+void f3 (void *, void (*)(void *));
+void f2 (void *);
+
+int foo (void *a, int b)
+{
+ if (!b)
+ {
+ f1 (a);
+ return 1;
+ }
+ if (b)
+ {
+ void bar (void *c)
+ {
+ if (c == a)
+ f2 (c);
+ }
+ f3 (a, bar);
+ }
+ return 0;
+}
--- /dev/null
+void foo (void)
+{
+ double a = 0.0;
+ double b = a;
+ if (&b != &a);
+}
--- /dev/null
+struct { char *m; long n; } a[20];
+int b = 20, c;
+void bar(void) __attribute__((__noreturn__));
+
+int
+foo(int x)
+{
+ int i;
+
+ for (i = 0; i < x; i++)
+ {
+ a[0].m = "a"; a[0].n = 10; c=1;
+ a[c].m = "b"; a[c].n = 32; c++;
+ if (c >= b) bar ();
+ a[c].m = "c"; a[c].n = 80; c++;
+ if (c >= b) bar ();
+ }
+ return 0;
+}
--- /dev/null
+typedef char *ident;
+#ident "This is ident"
+ident i;
--- /dev/null
+struct A { unsigned long buf[100]; };
+int foo(unsigned int *x)
+{
+ unsigned int a;
+
+ if (!x)
+ return -22;
+
+#ifdef __ia64__
+ if (({
+ register long b asm ("r8") = 0;
+ register long c asm ("r9") = 0;
+ asm ("" : "=r"(c), "=r"(b) : "m"(*(struct A *)x), "1"(b));
+ a = (unsigned int) c;
+ b; }))
+ return -14;
+#endif
+
+ return 0;
+}
--- /dev/null
+void f(int n)
+{
+bugcauser:
+ if (n != 0)
+ f(n-1);
+ return;
+}
--- /dev/null
+typedef __SIZE_TYPE__ size_t;
+extern size_t strlen (const char *s);
+
+typedef struct A {
+ int a, b;
+} A;
+
+typedef struct B {
+ struct A **a;
+ int b;
+} B;
+
+A *a;
+int b = 1, c;
+B d[1];
+
+void foo (A *x, const char *y, int z)
+{
+ c = y[4] + z * 25;
+}
+
+A *bar (const char *v, int w, int x, const char *y, int z)
+{
+ if (w)
+ abort ();
+ exit (0);
+}
+
+void test (const char *x, int *y)
+{
+ foo (d->a[d->b], "test", 200);
+ d->a[d->b] = bar (x, b ? 0 : 65536, strlen (x), "test", 201);
+ d->a[d->b]->a++;
+ if (y)
+ d->a[d->b]->b = *y;
+}
+
+int main ()
+{
+ d->b = 0;
+ d->a = &a;
+ test ("", 0);
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+
+unsigned char a[256], b[256], c[256], d[256];
+
+void foo(unsigned char *x, int y, unsigned char *z)
+{
+}
+
+void bar(int x, ...)
+{
+}
+
+void baz(int y)
+{
+ if (y != 0x10)
+ abort();
+}
+
+void test(int x, unsigned char *y)
+{
+ unsigned char g,h,j, k[5],l[5], m[30];
+ int i;
+
+ bar(x, y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], y[8], y[9]);
+ for (i = 5; --i >= 0; )
+ k[i] = y[5 + i] ^ a[i] ^ c[i];
+
+ foo(&m[29], sizeof m, k);
+ g = d[x] ^ c[x];
+ bar(x, d[x], x, c[x]);
+ baz(g);
+ for (i = 5, h = 0; --i >= 0; h = y[i])
+ {
+ j = m[25 + i] ^ y[i];
+ j = b[j] ^ g;
+ k[i] = c[j] ^ h;
+ }
+ for (i = 5, h = 0; --i >= 0; h = k[i])
+ {
+ j = m[20 + i] ^ k[i];
+ j = b[j] ^ g;
+ l[i] = c[j] ^ h;
+ }
+ for (i = 5, h = 0; --i >= 0; h = l[i]) {
+ j = m[15 + i] ^ l[i];
+ j = b[j] ^ g;
+ j = c[j] ^ h;
+ k[i] = a[j] ^ c[j];
+ }
+}
+
+int main()
+{
+ c[4] = 0xdc;
+ d[4] = 0xcc;
+ test(4, a);
+ exit(0);
+}
--- /dev/null
+/* { dg-do run { target sparc*-*-* } } */
+/* { dg-options "-O2 -mvis" } */
+
+int foo(double a, int b, int c, double *d, int h)
+{
+ int f, g;
+ double e;
+
+l:
+ f = (int) a;
+ a -= (double) f;
+ if (b == 1)
+ {
+ g = c;
+ f += g;
+ c -= g;
+ }
+ if (b == 2)
+ {
+ f++;
+ h = c;
+ }
+ if (!h)
+ {
+ for (g = 0; g <= 10; g++)
+ for (h = 0; h <= 10; h++)
+ e += d [10 + g - h];
+ goto l;
+ }
+ return f & 7;
+}
+
+int main()
+{
+ if (foo(0.1, 1, 3, 0, 1) != 3)
+ abort ();
+ exit (0);
+}
--- /dev/null
+/* { dg-do run { target sparc*-*-* } } */
+/* { dg-options "-O2 -mvis" } */
+
+int foo(double a, int b, int c, double *d, int h)
+{
+ int f, g;
+ double e;
+
+l:
+ f = (int) a;
+ a -= (double) f;
+ if (b == 1)
+ {
+ g = c;
+ f += g;
+ c -= g;
+ }
+ if (b == 2)
+ {
+ f++;
+ h = c;
+ goto l;
+ }
+
+ asm volatile ("" : : :
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31");
+
+ return f & 7;
+}
+
+int main()
+{
+ if (foo(0.1, 1, 3, 0, 1) != 3)
+ abort ();
+ exit (0);
+}
--- /dev/null
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O3 -gdwarf-2" } */
+
+extern inline int f1 (void) {return f2();}
+int f3 (void) {return f1();}
+int f1 (void) {return 0;}
--- /dev/null
+__inline__ double bar(double *x)
+{
+ static double a;
+ a = *x >= 0 ? *x : -*x;
+ return a;
+}
+
+int main(void)
+{
+ extern double bar();
+ double a;
+ static double b;
+ int r;
+ for (r = 1; r < 3; r++) {
+ a = 1.0;
+ b = bar(&a);
+ }
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-Os" } */
+
+extern void abort (void);
+
+void foo (unsigned long x)
+{
+}
+
+typedef struct a {
+ volatile unsigned int a1, a2, a3, a4, a5;
+} *A;
+typedef struct {
+ volatile unsigned int b1, b2, b3, b4, b5;
+} *B;
+struct C {
+ void *c1, *c2;
+ A c3;
+ unsigned char c4;
+};
+
+void
+bar (struct C *c, unsigned int *d)
+{
+ *d = *d | 1;
+ ((c->c4 >= 2)
+ ? (*(volatile unsigned int *) ((void *)(&((A)c->c3)->a5)) = *d)
+ : (*(volatile unsigned int *) ((void *)(&((B)c->c3)->b5)) = *d));
+
+ foo (50);
+}
+
+int main (void)
+{
+ struct a a;
+ struct C c;
+ unsigned int d = 8;
+ c.c3 = &a;
+ c.c4 = 0;
+ bar (&c, &d);
+ if (a.a5 != 9)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -mcpu=k6" } */
+
+void
+foo (unsigned char *x, const unsigned char *y)
+{
+ int a = 6;
+ unsigned char *b;
+ for (;;)
+ {
+ unsigned char *c = x;
+
+ while (1)
+ {
+ if (c + 2 < y)
+ c += 3;
+ else
+ break;
+ }
+ b = x + a;
+ if (*c == 4 || *c == 5)
+ {
+ unsigned char d = c[2];
+
+ if (b[3] == 7 || b[3] == 8)
+ {
+ int e = b[3] == 8;
+ if (d < b[4] * 8 && b[5 + d / 8] & (1 << (d % 8)))
+ e = !e;
+ if (!e)
+ x[-3] = 26;
+ }
+ }
+ else if (*c == 7 && b[3] == 8)
+ {
+ int f;
+ for (f = 0; f < (int) c[1]; f++)
+ if (!(c[2 + f] == 0))
+ break;
+ if (f == c[1])
+ x[-3] = 26;
+ }
+ x -= 2;
+ }
+}
--- /dev/null
+struct foo bar[] = { {"baz"} }; /* { dg-error "have incomplete type|excess elements|near|assumed|storage size" } */