20010226-1.c: New test.
authorJakub Jelinek <jakub@redhat.com>
Wed, 9 Jan 2002 21:34:32 +0000 (22:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 9 Jan 2002 21:34:32 +0000 (22:34 +0100)
* 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.

From-SVN: r48693

16 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20010226-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20010227-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20010426-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20010510-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20010605-3.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20010824-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20010409-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20001023-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20001101-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20001102-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20010207-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20010405-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20010822-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/20011107-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/noncompile/20000901-1.c [new file with mode: 0644]

index 7c6602f499562560df64e610c55ec6af564ef126..d9a1885973d94f59692287b8e0fd0b789c5de0b1 100644 (file)
@@ -1,3 +1,21 @@
+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
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010226-1.c b/gcc/testsuite/gcc.c-torture/compile/20010226-1.c
new file mode 100644 (file)
index 0000000..c06be53
--- /dev/null
@@ -0,0 +1,22 @@
+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;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010227-1.c b/gcc/testsuite/gcc.c-torture/compile/20010227-1.c
new file mode 100644 (file)
index 0000000..767cb0d
--- /dev/null
@@ -0,0 +1,6 @@
+void foo (void)
+{
+  double a = 0.0;
+  double b = a;
+  if (&b != &a);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010426-1.c b/gcc/testsuite/gcc.c-torture/compile/20010426-1.c
new file mode 100644 (file)
index 0000000..356818f
--- /dev/null
@@ -0,0 +1,19 @@
+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;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010510-1.c b/gcc/testsuite/gcc.c-torture/compile/20010510-1.c
new file mode 100644 (file)
index 0000000..23d44f8
--- /dev/null
@@ -0,0 +1,3 @@
+typedef char *ident;
+#ident "This is ident"
+ident i;
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010605-3.c b/gcc/testsuite/gcc.c-torture/compile/20010605-3.c
new file mode 100644 (file)
index 0000000..a43c0b1
--- /dev/null
@@ -0,0 +1,20 @@
+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;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010824-1.c b/gcc/testsuite/gcc.c-torture/compile/20010824-1.c
new file mode 100644 (file)
index 0000000..8e67722
--- /dev/null
@@ -0,0 +1,7 @@
+void f(int n)
+{
+bugcauser:
+  if (n != 0)
+    f(n-1);
+  return;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20010409-1.c b/gcc/testsuite/gcc.c-torture/execute/20010409-1.c
new file mode 100644 (file)
index 0000000..95a5dc3
--- /dev/null
@@ -0,0 +1,43 @@
+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);
+}
diff --git a/gcc/testsuite/gcc.dg/20001023-1.c b/gcc/testsuite/gcc.dg/20001023-1.c
new file mode 100644 (file)
index 0000000..ce5e532
--- /dev/null
@@ -0,0 +1,59 @@
+/* { 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);
+}
diff --git a/gcc/testsuite/gcc.dg/20001101-1.c b/gcc/testsuite/gcc.dg/20001101-1.c
new file mode 100644 (file)
index 0000000..b5231f2
--- /dev/null
@@ -0,0 +1,38 @@
+/* { 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);
+}
diff --git a/gcc/testsuite/gcc.dg/20001102-1.c b/gcc/testsuite/gcc.dg/20001102-1.c
new file mode 100644 (file)
index 0000000..9d1ccb3
--- /dev/null
@@ -0,0 +1,39 @@
+/* { 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);
+}
diff --git a/gcc/testsuite/gcc.dg/20010207-1.c b/gcc/testsuite/gcc.dg/20010207-1.c
new file mode 100644 (file)
index 0000000..1958f4c
--- /dev/null
@@ -0,0 +1,6 @@
+/* { 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;}
diff --git a/gcc/testsuite/gcc.dg/20010405-1.c b/gcc/testsuite/gcc.dg/20010405-1.c
new file mode 100644 (file)
index 0000000..b4d57a5
--- /dev/null
@@ -0,0 +1,19 @@
+__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;
+}
diff --git a/gcc/testsuite/gcc.dg/20010822-1.c b/gcc/testsuite/gcc.dg/20010822-1.c
new file mode 100644 (file)
index 0000000..b1c1cd4
--- /dev/null
@@ -0,0 +1,44 @@
+/* { 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;
+}
diff --git a/gcc/testsuite/gcc.dg/20011107-1.c b/gcc/testsuite/gcc.dg/20011107-1.c
new file mode 100644 (file)
index 0000000..0e969fd
--- /dev/null
@@ -0,0 +1,45 @@
+/* { 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;
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/noncompile/20000901-1.c b/gcc/testsuite/gcc.dg/noncompile/20000901-1.c
new file mode 100644 (file)
index 0000000..94df14a
--- /dev/null
@@ -0,0 +1 @@
+struct foo bar[] = { {"baz"} }; /* { dg-error "have incomplete type|excess elements|near|assumed|storage size" } */