gcc/testsuite/gcc.dg/pr107787.c
raw| 1 | /* PR driver/107787 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-O2 -Werror=array-bounds=1" } */ |
| 4 | /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ |
| 5 | |
| 6 | int a[10]; /* { dg-note "while referencing" } */ |
| 7 | |
| 8 | int* f(void) { |
| 9 | |
| 10 | a[-1] = 0; /* { dg-error "is below array bounds" } */ |
| 11 | |
| 12 | return a; |
| 13 | } |