gcc/testsuite/c-c++-common/ubsan/bounds-4.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fsanitize=bounds -Wall -Wextra -Wno-array-bounds -Wno-unused" } */ |
| 3 | |
| 4 | /* Initializers of TREE_STATICs aren't instrumented. |
| 5 | But don't ICE on 'em. */ |
| 6 | |
| 7 | int A[2]; |
| 8 | int *gp = &A[4]; |
| 9 | int *gpi; |
| 10 | |
| 11 | int |
| 12 | main (void) |
| 13 | { |
| 14 | gpi = &A[4]; /* This will warn with -Warray-bounds, but only if VRP runs. */ |
| 15 | static int *pi = &A[4]; |
| 16 | return 0; |
| 17 | } |