gcc/testsuite/c-c++-common/ubsan/bounds-18.c
raw| 1 | /* PR sanitizer/108060 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-fsanitize=bounds" } */ |
| 4 | /* { dg-skip-if "" { *-*-* } "-flto" } */ |
| 5 | /* { dg-shouldfail "ubsan" } */ |
| 6 | |
| 7 | int a[8]; |
| 8 | int c; |
| 9 | |
| 10 | int |
| 11 | main () |
| 12 | { |
| 13 | int b = -32768; |
| 14 | a[b] = a[b] | c; |
| 15 | } |
| 16 | |
| 17 | /* { dg-output "index -32768 out of bounds for type 'int \\\[8\\\]'" } */ |