struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20070212-3.c
blob6274dffa50d2520c9b0e448656c19c49f05b9b90
1 /*
2 20070212-3.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 foo { int i; int j; };
13 int bar (struct foo *k, int k2, int f, int f2)
15 int *p, *q;
16 int res;
17 if (f)
18 p = &k->i;
19 else
20 p = &k->j;
21 res = *p;
22 k->i = 1;
23 if (f2)
24 q = p;
25 else
26 q = &k2;
27 return res + *q;
30 void
31 testTortureExecute (void)
33 struct foo k;
34 k.i = 0;
35 k.j = 1;
36 if (bar (&k, 1, 1, 1) != 1)
37 ASSERT (0);
38 return;