diff gcc/testsuite/gcc.dg/Warray-bounds-35.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-35.c	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,15 @@
+/* PR tree-optimization/87072 - g++6.2.0 false warning: array subscript
+   is above array bounds, with misleading line number
+   { dg-do compile }
+   { dg-options "-O3 -Wall" }  */
+
+int a[10];
+
+void f (unsigned n)
+{
+  for (unsigned j = 0; j < n; j++) {
+     for (unsigned k = 0; k < j; k++)
+       a[j] += k;                       /* { dg-bogus "\\\[-Warray-bounds]" } */
+     a[j] += j;
+  }
+}