gcc/testsuite/gcc.c-torture/execute/vla-dealloc-1.c
raw| 1 | /* VLAs should be deallocated on a jump to before their definition, |
| 2 | including a jump to a label in an inner scope. PR 19771. */ |
| 3 | |
| 4 | #if (__SIZEOF_INT__ <= 2) |
| 5 | #define LIMIT 10000 |
| 6 | #else |
| 7 | #define LIMIT 1000000 |
| 8 | #endif |
| 9 | |
| 10 | void *volatile p; |
| 11 | |
| 12 | int |
| 13 | main (void) |
| 14 | { |
| 15 | int n = 0; |
| 16 | if (0) |
| 17 | { |
| 18 | lab:; |
| 19 | } |
| 20 | int x[n % 1000 + 1]; |
| 21 | x[0] = 1; |
| 22 | x[n % 1000] = 2; |
| 23 | p = x; |
| 24 | n++; |
| 25 | if (n < LIMIT) |
| 26 | goto lab; |
| 27 | return 0; |
| 28 | } |