gcc/testsuite/gcc.dg/Warray-bounds-35.c
raw| 1 | /* PR tree-optimization/87072 - g++6.2.0 false warning: array subscript |
| 2 | is above array bounds, with misleading line number |
| 3 | { dg-do compile } |
| 4 | { dg-options "-O3 -Wall" } */ |
| 5 | |
| 6 | int a[10]; |
| 7 | |
| 8 | void f (unsigned n) |
| 9 | { |
| 10 | for (unsigned j = 0; j < n; j++) { |
| 11 | for (unsigned k = 0; k < j; k++) |
| 12 | a[j] += k; /* { dg-bogus "\\\[-Warray-bounds]" } */ |
| 13 | a[j] += j; |
| 14 | } |
| 15 | } |