]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Thu, 26 Sep 2002 23:12:17 +0000 (23:12 +0000)
committerNo Author <no-author@gcc.gnu.org>
Thu, 26 Sep 2002 23:12:17 +0000 (23:12 +0000)
'gcc-3_2-branch'.

From-SVN: r57559

gcc/testsuite/gcc.c-torture/execute/loop-15.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.c-torture/execute/loop-15.c b/gcc/testsuite/gcc.c-torture/execute/loop-15.c
new file mode 100644 (file)
index 0000000..8cb5125
--- /dev/null
@@ -0,0 +1,40 @@
+/* Bombed with a segfault on powerpc-linux.  doloop.c generated wrong
+   loop count.  */
+void
+foo (unsigned long *start, unsigned long *end)
+{
+  unsigned long *temp = end - 1;
+
+  while (end > start)
+    *end-- = *temp--;
+}
+
+int
+main (void)
+{
+  unsigned long a[5];
+  int start, end, k;
+
+  for (start = 0; start < 5; start++)
+    for (end = 0; end < 5; end++)
+      {
+       for (k = 0; k < 5; k++)
+         a[k] = k;
+
+       foo (a + start, a + end);
+
+       for (k = 0; k <= start; k++)
+         if (a[k] != k)
+           abort ();
+
+       for (k = start + 1; k <= end; k++)
+         if (a[k] != k - 1)
+           abort ();
+
+       for (k = end + 1; k < 5; k++)
+         if (a[k] != k)
+           abort ();
+      }
+
+  return 0;
+}