From e6bd9c42b0ad0cc4a615135612599adb829f2d9c Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Wed, 1 Sep 2021 08:06:48 +0200
Subject: [PATCH] tree-optimization/102149 - add testcase for fixed bug

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 | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/torture/pr102149.c

diff --git a/gcc/testsuite/gcc.dg/torture/pr102149.c b/gcc/testsuite/gcc.dg/torture/pr102149.c
new file mode 100644
index 000000000000..34a8c213133c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102149.c
@@ -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;
+}
-- 
GitLab