This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Testcase for PR66974


Committed.

2017-12-14  Richard Biener  <rguenther@suse.de>

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

Index: gcc/testsuite/gcc.dg/Warray-bounds-24.c
===================================================================
--- gcc/testsuite/gcc.dg/Warray-bounds-24.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/Warray-bounds-24.c	(working copy)
@@ -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];
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]