struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20080522-1.c
blobf55bd878b09bf6ac7812638d33f20b72e5072329
1 /*
2 20080522-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 /* This testcase is to make sure we have i in referenced vars and that we
12 properly compute aliasing for the loads and stores. */
14 static int i;
15 static int *p = &i;
17 int
18 foo(int *q)
20 *p = 1;
21 *q = 2;
22 return *p;
25 int
26 bar(int *q)
28 *q = 2;
29 *p = 1;
30 return *q;
33 void
34 testTortureExecute (void)
36 int j = 0;
38 if (foo(&i) != 2)
39 ASSERT (0);
40 if (bar(&i) != 1)
41 ASSERT (0);
42 if (foo(&j) != 1)
43 ASSERT (0);
44 if (j != 2)
45 ASSERT (0);
46 if (bar(&j) != 2)
47 ASSERT (0);
48 if (j != 2)
49 ASSERT (0);
51 return;