re PR tree-optimization/66974 (-Warray-bounds false positive with -O3)
authorRichard Biener <rguenther@suse.de>
Thu, 14 Dec 2017 15:18:16 +0000 (15:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 14 Dec 2017 15:18:16 +0000 (15:18 +0000)
2017-12-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/66974
* gcc.dg/Warray-bounds-24.c: New testcase.

From-SVN: r255642

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Warray-bounds-24.c [new file with mode: 0644]

index 981c3a2771f0fe96e973035337878f05992a9501..a053fcba4d08cb0d97c7d7c40767cde656557b18 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/66974
+       * gcc.dg/Warray-bounds-24.c: New testcase.
+
 2017-12-14  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/65258
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-24.c b/gcc/testsuite/gcc.dg/Warray-bounds-24.c
new file mode 100644 (file)
index 0000000..3563173
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Warray-bounds" } */
+
+int foo(unsigned order)
+{
+  int c[3] = {1, 2, 3};
+  unsigned i, j;
+  for (i = 1; i < order; i++) {
+      for (j = 0; j < i / 2; j++) {
+         c[j] += c[i] * c[i-j-1]; /* { dg-bogus "array bounds" } */
+         c[i-j-1] += c[i] * c[j]; /* { dg-bogus "array bounds" } */
+      }
+  }
+  return c[0];
+}