struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20030828-2.c
blob43e7dbe2b3c56c79a9cd5df7e6aefb12e3b55ad7
1 /*
2 20030828-2.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 struct rtx_def
13 int code;
16 void
17 testTortureExecute (void)
19 int tmp[2];
20 struct rtx_def *r, s;
21 int *p, *q;
23 /* The alias analyzer was creating the same memory tag for r, p and q
24 because 'struct rtx_def *' is type-compatible with 'int *'. However,
25 the alias set of 'int[2]' is not the same as 'int *', so variable
26 'tmp' was deemed not aliased with anything. */
27 r = &s;
28 r->code = 39;
30 /* If 'r' wasn't declared, then q and tmp would have had the same memory
31 tag. */
32 p = tmp;
33 q = p + 1;
34 *q = 0;
35 tmp[1] = 39;
36 if (*q != 39)
37 ASSERT (0);
38 return;