Add testcase for PR103615
authorRichard Biener <rguenther@suse.de>
Mon, 3 Jan 2022 08:56:13 +0000 (09:56 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 3 Jan 2022 08:56:13 +0000 (09:56 +0100)
This adds a testcase for a fixed wrong-code bug.

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

PR tree-optimization/103615
* gcc.dg/torture/pr103615.c: New testcase.

gcc/testsuite/gcc.dg/torture/pr103615.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/torture/pr103615.c b/gcc/testsuite/gcc.dg/torture/pr103615.c
new file mode 100644 (file)
index 0000000..2109245
--- /dev/null
@@ -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;
+}