gcc/testsuite/c-c++-common/ubsan/bounds-16.c
raw| 1 | /* PR sanitizer/108894 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-fsanitize=bounds -fsanitize-recover=bounds" } */ |
| 4 | /* { dg-output "index 1 out of bounds for type 'int \\\[\[*0-9x]*\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ |
| 5 | /* { dg-output "\[^\n\r]*index 0 out of bounds for type 'int \\\[\[*0-9x]*\\\]'" } */ |
| 6 | |
| 7 | struct S { int a; int b[0]; int c; } s; |
| 8 | |
| 9 | int |
| 10 | main () |
| 11 | { |
| 12 | int *volatile p = &s.b[0]; |
| 13 | p = &s.b[1]; |
| 14 | int volatile q = s.b[0]; |
| 15 | } |