re PR rtl-optimization/13521 ([3.3 only] Endless loop in calculate_global_regs_live)
authorJakub Jelinek <jakub@redhat.com>
Thu, 1 Jan 2004 13:21:18 +0000 (14:21 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 1 Jan 2004 13:21:18 +0000 (14:21 +0100)
PR optimization/13521
* gcc.c-torture/compile/20031231-1.c: New test.

From-SVN: r75301

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20031231-1.c [new file with mode: 0644]

index af9fabfa808bf532a8900e8a519f5ab153c78748..17e55806840b732fd02fb038e37130f1db841fbd 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR optimization/13521
+       * gcc.c-torture/compile/20031231-1.c: New test.
+
 2003-12-30  Kazu Hirata  <kazu@cs.umass.edu>
 
        * gcc.dg/sibcall-4.c: Replace mn10?00 with mn10300.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20031231-1.c b/gcc/testsuite/gcc.c-torture/compile/20031231-1.c
new file mode 100644 (file)
index 0000000..bbd8e7c
--- /dev/null
@@ -0,0 +1,51 @@
+extern int f1 (int, void *);
+extern int *f2 (void) __attribute__ ((__const__));
+extern int f3 (int, void *);
+
+int
+test (int x, char *y, int z)
+{
+  int b = 0;
+
+  if (x < 1024)
+    {
+      y[0] = '\0';
+
+      do
+       {
+         switch (f1 (x, y + b))
+           {
+           case -1:
+             if (b == 0)
+               return -1;
+             else
+               return b;
+
+           default:
+             b++;
+           }
+       }
+      while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z);
+    }
+  else
+    {
+      do
+       {
+         switch (f3 (x, y + b))
+           {
+           case -1:
+             if ((*f2 ()) == 4)
+               continue;
+             if (b == 0)
+               return -1;
+             else
+               return b;
+
+           default:
+             b++;
+           }
+       }
+      while (y[b - 1] != '\0' && y[b - 1] != '\n' && b < z);
+    }
+  return b;
+}