gcc/testsuite/c-c++-common/ubsan/bounds-10.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=bounds-strict" } */ |
| 3 | |
| 4 | struct V { int l; int a[1]; }; |
| 5 | |
| 6 | int |
| 7 | main (void) |
| 8 | { |
| 9 | /* For strict, do instrument last array in a struct. */ |
| 10 | struct V *v = (struct V *) __builtin_malloc (sizeof (struct V) + 10); |
| 11 | v->a[1] = 1; |
| 12 | |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | /* { dg-output "index 1 out of bounds for type 'int \\\[1\\\]'" } */ |