gcc/testsuite/c-c++-common/ubsan/bounds-20.c
raw| 1 | /* PR sanitizer/109050 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-fsanitize=bounds -fno-sanitize-recover=all" } */ |
| 4 | /* { dg-shouldfail "ubsan" } */ |
| 5 | |
| 6 | long a; |
| 7 | int b; |
| 8 | int |
| 9 | main () |
| 10 | { |
| 11 | int c[4] = {0, 1, 2, 3}; |
| 12 | a = 0; |
| 13 | c[a - 9806816] |= b; |
| 14 | } |
| 15 | |
| 16 | /* { dg-output "index -9806816 out of bounds for type 'int \\\[4\\\]'" } */ |