PR optimization/13521
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jan 2004 13:21:18 +0000 (13:21 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jan 2004 13:21:18 +0000 (13:21 +0000)
* gcc.c-torture/compile/20031231-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75301 138bc75d-0d04-0410-961f-82ee72b054a4

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

index af9fabf..17e5580 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;
+}