struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050124-1.c
blobba305c48ae02cd8428f95dfff7c480e541908551
1 /*
2 20050124-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 rtl-optimization/19579 */
13 int
14 foo (int i, int j)
16 int k = i + 1;
18 if (j)
20 if (k > 0)
21 k++;
22 else if (k < 0)
23 k--;
26 return k;
29 void
30 testTortureExecute (void)
32 if (foo (-2, 0) != -1)
33 ASSERT (0);
34 if (foo (-1, 0) != 0)
35 ASSERT (0);
36 if (foo (0, 0) != 1)
37 ASSERT (0);
38 if (foo (1, 0) != 2)
39 ASSERT (0);
40 if (foo (-2, 1) != -2)
41 ASSERT (0);
42 if (foo (-1, 1) != 0)
43 ASSERT (0);
44 if (foo (0, 1) != 2)
45 ASSERT (0);
46 if (foo (1, 1) != 3)
47 ASSERT (0);
48 return;