aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-09-26 23:05:57 +0000
committerAlan Modra <amodra@gcc.gnu.org>2002-09-27 08:35:57 +0930
commita7215b32249d0936b0ebf1ab8b4176e6a55ceb24 (patch)
tree5e1c209dd6c84a6cbd0a1bba8ed4cf9e5ee59fcf /gcc/testsuite
parentb5a77fef8cb83bffcd1d5cf57eb74f48298e3bdb (diff)
downloadgcc-a7215b32249d0936b0ebf1ab8b4176e6a55ceb24.zip
gcc-a7215b32249d0936b0ebf1ab8b4176e6a55ceb24.tar.gz
gcc-a7215b32249d0936b0ebf1ab8b4176e6a55ceb24.tar.bz2
* gcc.c-torture/execute/loop-15.c: New.
From-SVN: r57557
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/loop-15.c40
2 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d312b01..cc0a7e1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-27 Alan Modra <amodra@bigpond.net.au>
+
+ * gcc.c-torture/execute/loop-15.c: New.
+
2002-09-26 Janis Johnson <janis187@us.ibm.com>
* README.QMTEST: Fix typo.
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
index 0000000..8cb5125
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/loop-15.c
@@ -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;
+}