2015-05-04 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vla-8.c
blobfea2337cb071e9274919a5c48ed0874c883e894b
1 /* { dg-do compile } */
2 /* { dg-options "-std=c99 -pedantic-errors" } */
3 /* Radar 4336222 */
5 int a;
6 struct s { void (*f)(int (*)[a]); };
8 static int i;
9 static int new_i() { i++; return i; }
10 static int bar1(int a[new_i()][new_i()]);
12 void foo(int n) {
13 extern void bar(int i[n][n]); /* Since this isn't a VM type ensure we can have linkage. */
14 extern int bar1(int a[new_i()][new_i()]); /* Since this isn't a VM type ensure we can have linkage. */
17 void foo1(int n) {
18 goto A;
19 void bar(int i[n][n]); /* Not a VM type, as VM arguments don't matter. */
20 int bar1(int a[new_i()][new_i()]); /* Not a VM type, as VM arguments don't matter. */
25 void foo2(int n) {
26 goto A; /* { dg-error "jump into scope of identifier with variably modified type" } */
27 int (*(*bar2)(void))[n];
32 /* Match extra informative notes. */
33 /* { dg-message "note: label '\[^\n'\]*' defined here" "defined" { target *-*-* } 0 } */
34 /* { dg-message "note: '\[^\n'\]*' declared here" "declared" { target *-*-* } 0 } */