gcc/testsuite/c-c++-common/vla-1.c
raw| 1 | /* Test that changes to a variable are reflected in a VLA later in the |
| 2 | expression. */ |
| 3 | /* { dg-options "" } */ |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" |
| 7 | #endif |
| 8 | void abort(); |
| 9 | |
| 10 | int i = 4; |
| 11 | int f() |
| 12 | { |
| 13 | return i; |
| 14 | } |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | if (i+=2, sizeof(*(int(*)[f()])0) != 6*sizeof(int)) |
| 19 | abort(); |
| 20 | return 0; |
| 21 | } |