struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20080604-1.c
blob443d8248682a6f76f783f93251600b3ecc677cf4
1 /*
2 20080604-1.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 barstruct { char const* some_string; } x;
13 void
14 foo(void)
16 if (!x.some_string)
17 ASSERT (0);
19 void baz(int b)
21 struct barstruct bar;
22 struct barstruct* barptr;
23 if (b)
24 barptr = &bar;
25 else
27 barptr = &x + 1;
28 barptr = barptr - 1;
30 barptr->some_string = "Everything OK";
31 foo();
32 barptr->some_string = "Everything OK";
35 void
36 testTortureExecute (void)
38 x.some_string = (void *)0;
39 baz(0);
40 if (!x.some_string)
41 ASSERT (0);
42 return;