gcc/testsuite/gcc.dg/vla-15.c
raw| 1 | /* Test for VLA size evaluation in sizeof typeof. */ |
| 2 | /* Origin: Joseph Myers <[email protected]> */ |
| 3 | /* { dg-do run } */ |
| 4 | /* { dg-options "-std=gnu99" } */ |
| 5 | |
| 6 | #include <stdarg.h> |
| 7 | |
| 8 | extern void exit (int); |
| 9 | extern void abort (void); |
| 10 | |
| 11 | char a[1]; |
| 12 | |
| 13 | void |
| 14 | f1 (void) |
| 15 | { |
| 16 | int i = 0; |
| 17 | int j = sizeof (typeof (*(++i, (char (*)[i])a))); |
| 18 | if (i != 1 || j != 1) |
| 19 | abort (); |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main (void) |
| 24 | { |
| 25 | f1 (); |
| 26 | exit (0); |
| 27 | } |