gcc/testsuite/gcc.dg/vla-2.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-std=gnu99" } */ |
| 3 | |
| 4 | /* These are crash tests related to PR middle-end/6994; see also |
| 5 | g++.dg/ext/vla1.C. Note that at present A and C cannot be inlined. */ |
| 6 | |
| 7 | static inline void A (int i) |
| 8 | { |
| 9 | struct S { int ar[1][i]; } s; |
| 10 | |
| 11 | s.ar[0][0] = 0; |
| 12 | } |
| 13 | |
| 14 | void B(void) |
| 15 | { |
| 16 | A(23); |
| 17 | } |
| 18 | |
| 19 | static inline void C (int i) |
| 20 | { |
| 21 | union U { int ar[1][i]; } u; |
| 22 | |
| 23 | u.ar[0][0] = 0; |
| 24 | } |
| 25 | |
| 26 | void D(void) |
| 27 | { |
| 28 | C(23); |
| 29 | } |