struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050613-1.c
blob79184a28df2c55a1becdf883982168ef00e67386
1 /*
2 20050613-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 /* PR tree-optimization/22043 */
13 struct A { int i; int j; int k; int l; };
14 struct B { struct A a; int r[1]; };
15 struct C { struct A a; int r[0]; };
16 struct D { struct A a; int r[]; };
18 void
19 foo (struct A *x)
21 ASSERT (x->i == 0);
22 ASSERT (x->j == 5);
23 ASSERT (x->k == 0);
24 ASSERT (x->l == 0);
27 void
28 testTortureExecute (void)
30 struct B b = { .a.j = 5 };
31 struct C c = { .a.j = 5 };
32 struct D d = { .a.j = 5 };
33 foo (&b.a);
34 foo (&c.a);
35 foo (&d.a);
36 return;