Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20000715-1.c
bloba59fc9c09731263743f07e612b7d1dd028e8be1e
1 /*
2 20000715-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 void
12 test1(void)
14 int x = 3, y = 2;
16 if ((x < y ? x++ : y++) != 2)
17 ASSERT (0);
19 if (x != 3)
20 ASSERT (0);
22 if (y != 3)
23 ASSERT (0);
26 void
27 test2(void)
29 int x = 3, y = 2, z;
31 z = (x < y) ? x++ : y++;
32 if (z != 2)
33 ASSERT (0);
35 if (x != 3)
36 ASSERT (0);
38 if (y != 3)
39 ASSERT (0);
42 void
43 test3(void)
45 int x = 3, y = 2;
46 int xx = 3, yy = 2;
48 if ((xx < yy ? x++ : y++) != 2)
49 ASSERT (0);
51 if (x != 3)
52 ASSERT (0);
54 if (y != 3)
55 ASSERT (0);
58 int x, y;
60 static void
61 init_xy(void)
63 x = 3;
64 y = 2;
67 void
68 test4(void)
70 init_xy();
71 if ((x < y ? x++ : y++) != 2)
72 ASSERT (0);
74 if (x != 3)
75 ASSERT (0);
77 if (y != 3)
78 ASSERT (0);
81 void
82 test5(void)
84 int z;
86 init_xy();
87 z = (x < y) ? x++ : y++;
88 if (z != 2)
89 ASSERT (0);
91 if (x != 3)
92 ASSERT (0);
94 if (y != 3)
95 ASSERT (0);
98 void
99 test6(void)
101 int xx = 3, yy = 2;
102 int z;
104 init_xy();
105 z = (xx < y) ? x++ : y++;
106 if (z != 2)
107 ASSERT (0);
109 if (x != 3)
110 ASSERT (0);
112 if (y != 3)
113 ASSERT (0);
116 void
117 testTortureExecute (void){
118 test1 ();
119 test2 ();
120 test3 ();
121 test4 ();
122 test5 ();
123 test6 ();
124 return;