struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20010924-1.c
blob04f707f9f1cf4fbb33a4e20e09a629d46f89163b
1 /*
2 20010924-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 147
10 #pragma disable_warning 196
11 #endif
13 /* Verify that flexible arrays can be initialized from STRING_CST
14 constructors. */
16 /* Baselines. */
17 struct {
18 char a1c;
19 char *a1p;
20 } a1 = {
21 '4',
22 "62"
25 struct {
26 char a2c;
27 char a2p[2];
28 } a2 = {
29 'v',
30 "cq"
33 /* The tests. */
34 struct {
35 char a3c;
36 char a3p[];
37 } a3 = {
38 'o',
39 "wx"
42 struct {
43 char a4c;
44 char a4p[];
45 } a4 = {
46 '9',
47 { 'e', 'b' }
50 void
51 testTortureExecute (void)
53 if (a1.a1c != '4')
54 ASSERT(0);
55 if (a1.a1p[0] != '6')
56 ASSERT(0);
57 if (a1.a1p[1] != '2')
58 ASSERT(0);
59 if (a1.a1p[2] != '\0')
60 ASSERT(0);
62 if (a2.a2c != 'v')
63 ASSERT(0);
64 if (a2.a2p[0] != 'c')
65 ASSERT(0);
66 if (a2.a2p[1] != 'q')
67 ASSERT(0);
69 if (a3.a3c != 'o')
70 ASSERT(0);
71 if (a3.a3p[0] != 'w')
72 ASSERT(0);
73 if (a3.a3p[1] != 'x')
74 ASSERT(0);
76 if (a4.a4c != '9')
77 ASSERT(0);
78 if (a4.a4p[0] != 'e')
79 ASSERT(0);
80 if (a4.a4p[1] != 'b')
81 ASSERT(0);
83 return;