annotate gcc/testsuite/gcc.dg/array-13.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do run } */
kono
parents:
diff changeset
2 /* { dg-options "" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 /* Verify that GCC's initialized flexible array member extension
kono
parents:
diff changeset
5 works properly. */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 extern void abort(void);
kono
parents:
diff changeset
8 extern void exit(int);
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 typedef int T[];
kono
parents:
diff changeset
11 typedef int T0[0];
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 struct f { int w; T x; };
kono
parents:
diff changeset
14 struct g { int w; T0 x; };
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 static struct f f = { 4, { 0, 1, 2, 3 } };
kono
parents:
diff changeset
17 static int junk1[] = { -1, -1, -1, -1 };
kono
parents:
diff changeset
18 static struct g g = { 4, { 0, 1, 2, 3 } }; /* { dg-warning "(excess elements)|(near initialization)" } */
kono
parents:
diff changeset
19 static int junk2[] = { -1, -1, -1, -1 };
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 int main()
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 int i;
kono
parents:
diff changeset
24 for (i = 0; i < f.w; ++i)
kono
parents:
diff changeset
25 if (f.x[i] != i)
kono
parents:
diff changeset
26 abort ();
kono
parents:
diff changeset
27 exit(0);
kono
parents:
diff changeset
28 }