struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-960326-1.c
blob5b9ed65ff550edef8cbd02739c24f693d09d2d13
1 /*
2 960326-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 struct s
13 char a;
14 int b;
15 short c;
16 int d[3];
17 long e;
20 struct s s0 = { .b = 3, .d = {2} };
21 struct s static s1 = { .b = 3, .d = {2} };
23 void
24 testTortureExecute (void)
26 #ifndef __SDCC_pdk14 // Lack of memory
27 struct s s2 = { .b = 3, .d = {2} };
28 static struct s s3 = { .b = 3, .d = {2} };
30 ASSERT (s0.a == 0 && s0.b == 3 && s0.c == 0 && s0.d[0] == 2 && s0.d[1] == 0 && s0.d[2] == 0 && s0.e == 0);
31 ASSERT (s1.a == 0 && s1.b == 3 && s1.c == 0 && s1.d[0] == 2 && s1.d[1] == 0 && s1.d[2] == 0 && s1.e == 0);
32 ASSERT (s2.a == 0 && s2.b == 3 && s2.c == 0 && s2.d[0] == 2 && s2.d[1] == 0 && s2.d[2] == 0 && s2.e == 0);
33 ASSERT (s3.a == 0 && s3.b == 3 && s3.c == 0 && s3.d[0] == 2 && s3.d[1] == 0 && s3.d[2] == 0 && s3.e == 0);
35 return;
36 #endif