gcc/testsuite/c-c++-common/ubsan/bounds-8.c
raw| 1 | /* PR sanitizer/65280 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-fsanitize=bounds" } */ |
| 4 | |
| 5 | int |
| 6 | main (void) |
| 7 | { |
| 8 | int *t = (int *) __builtin_malloc (sizeof (int) * 10); |
| 9 | int (*a)[1] = (int (*)[1]) t; |
| 10 | (*a)[2] = 1; |
| 11 | } |
| 12 | |
| 13 | /* { dg-output "index 2 out of bounds for type 'int \\\[1\\\]'" } */ |