diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/Warray-bounds-35.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Warray-bounds-35.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-35.c b/gcc/testsuite/gcc.dg/Warray-bounds-35.c new file mode 100644 index 00000000000..b3ad3625206 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-35.c @@ -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; + } +} |