| 1 |
/* PR middle-end/92333 - missing variable name referencing VLA in warnings |
| 2 |
PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall -fno-tree-vectorize" } */ |
| 5 |
|
| 6 |
void sink (void*); |
| 7 |
|
| 8 |
void test_struct_char_vla_location (void) |
| 9 |
{ |
| 10 |
unsigned nelts = 7; |
| 11 |
|
| 12 |
struct { |
| 13 |
char cvla[nelts]; // { dg-message "declared here|while referencing" } |
| 14 |
} s; |
| 15 |
|
| 16 |
s.cvla[0] = __LINE__; |
| 17 |
s.cvla[nelts - 1] = 0; |
| 18 |
s.cvla[nelts] = 0; // { dg-warning "\\\[-Warray-bounds" } |
| 19 |
|
| 20 |
sink (&s); |
| 21 |
} |