tree-optimization/102149 - add testcase for fixed bug
authorRichard Biener <rguenther@suse.de>
Wed, 1 Sep 2021 06:06:48 +0000 (08:06 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 1 Sep 2021 07:50:59 +0000 (09:50 +0200)
This adds the testcase from the PR.

2021-09-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102149
* gcc.dg/torture/pr102149.c: New testcase.

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

diff --git a/gcc/testsuite/gcc.dg/torture/pr102149.c b/gcc/testsuite/gcc.dg/torture/pr102149.c
new file mode 100644 (file)
index 0000000..34a8c21
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-vect-cost-model" } */
+
+int a[8];
+int *b = &a[6];
+char c;
+int main()
+{
+  int d = 7;
+  for (; d >= 0; d--)
+    {
+      *b = 1;
+      c = a[d] >> 3;
+      a[d] = c;
+    }
+  if (a[6] != 1)
+    __builtin_abort ();
+  return 0;
+}