This adds a testcase for a fixed wrong-code bug.

Tested on x86_64-unknown-linux-gnu, pushed.

2022-01-03  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/103615
        * gcc.dg/torture/pr103615.c: New testcase.
---
 gcc/testsuite/gcc.dg/torture/pr103615.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/torture/pr103615.c

diff --git a/gcc/testsuite/gcc.dg/torture/pr103615.c 
b/gcc/testsuite/gcc.dg/torture/pr103615.c
new file mode 100644
index 00000000000..2109245e622
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr103615.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+
+int z = 5;
+int a[6] = { 0, 0, 0, 0, 0, 1 };
+int main()
+{
+  for (int x = 5; x; x--)
+    for (int y = z; y >= x; y--)
+      a[y - x] += a[y];
+  if (a[0] != 7)
+    __builtin_abort ();
+  return 0;
+}
-- 
2.31.1

Reply via email to