* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
[official-gcc.git] / gcc / testsuite / gcc.dg / array-5.c
blob1717de4ba8e3093b9db3d761101f6fb28481861e
1 /* { dg-do compile } */
2 /* { dg-options "" } */
4 /* Check compatibility of array declarations. */
6 /* Incomplete decl matches. */
7 extern char arr0[];
8 char arr0[1];
10 /* Two integral expressions must be the same. Note that 0 is
11 a gcc extension, but it should work like any other constant. */
12 extern char arr1[1];
13 char arr1[1];
14 extern char arr2[0];
15 char arr2[0];
16 extern char arr3[0]; /* { dg-error "previous declaration" } */
17 char arr3[1]; /* { dg-error "conflicting types" } */
19 /* Variable size matches. */
20 void func(int n, int m)
22 /* The next two are from the example in c99 6.7.5.2/9. */
24 /* Invalid: not compatible because 4 != 6. */
25 int a[n][6][m];
26 int (*p)[4][n+1];
27 p = a; /* { dg-error "incompatible" } */
30 /* Compatible, but defined behavior only if n == 6 and m == n+1. */
31 int c[n][n][6][m];
32 int (*r)[n][n][n+1];
33 r = c;
36 /* Compatible, but undefined behavior; (2, 2) is not a constant
37 expression, and thus A is a VLA. */
38 int a[6][(2, 2)];
39 int (*p)[3];
40 p = a; /* { dg-bogus "incompatible" "bad vla handling" } */