* tree-ssa-loop-manip.c (split_loop_exit_edge): Return the new block.
[official-gcc.git] / gcc / testsuite / gcc.dg / vla-4.c
blob7ffbfb31b8e4b47a4585bf4c5800995ad5611c2f
1 /* { dg-do run } */
2 /* { dg-options "-std=c99 -pedantic-errors" } */
3 /* PR c/18740 */
5 static int i;
7 int foo(int n)
9 int (*t)[n];
10 i = 0;
11 int j = 0;
12 char b[1][n+3]; /* Variable length array. */
13 int d[3][n]; /* Variable length array. */
14 sizeof (b[i++ + sizeof(j++)]); /* Outer sizeof is evaluated for vla, but not the inner one. */
15 if (i != 1 || j != 0)
16 return 1;
17 __typeof__(b[i++]) c1; /* typeof is evauluated when given a vm */
18 if (i != 2)
19 return 1;
20 __typeof__(t + (i++,0)) c2; /* typeof is evauluated when given a vm */
21 if (i != 3)
22 return 1;
23 __typeof__(i + (i++,0)) c3; /* typeof is not evauluated when not given a vm */
24 if (i != 3)
25 return 1;
26 sizeof (d[i++]); /* sizeof is evaluated for vla. */
27 if (i != 4)
28 return 1;
29 __alignof__(__typeof__(t + (i++,0))); /* typeof is not evauluated when given a vm inside alignof*/
30 if (i != 4)
31 return 1;
32 sizeof(__typeof__(t + (i++,0))); /* typeof is not evauluated when given a vm inside sizeof*/
33 if (i != 4)
34 return 1;
35 return 0;
38 int foo6(int a, int b[a][a], int (*c)[sizeof(*b)]) {
39 return sizeof (*c);
42 int main() {
43 int b[10][10];
44 int (*c)[sizeof(int)*10];
45 if (foo6(10, b, c) != 10*sizeof(int)*sizeof(int))
46 return 1;
47 return foo(10);