struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-divcmp-4.c
blobb03e4ce88bd50f0a4f13d50324988aa19fb75843
1 /*
2 divcmp-4.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 /* PR middle-end/17894 */
13 int test1(int x)
15 return x/-10 == 2;
18 int test2(int x)
20 return x/-10 == 0;
23 int test3(int x)
25 return x/-10 != 2;
28 int test4(int x)
30 return x/-10 != 0;
32 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
33 int test5(int x)
35 return x/-10 < 2;
38 int test6(int x)
40 return x/-10 < 0;
43 int test7(int x)
45 return x/-10 <= 2;
47 #ifndef __SDCC_pdk14 // Lack of memory
48 int test8(int x)
50 return x/-10 <= 0;
53 int test9(int x)
55 return x/-10 > 2;
58 int test10(int x)
60 return x/-10 > 0;
63 int test11(int x)
65 return x/-10 >= 2;
68 int test12(int x)
70 return x/-10 >= 0;
72 #endif
73 #endif
75 void
76 testTortureExecute (void)
78 if (test1(-30) != 0)
79 ASSERT (0);
80 if (test1(-29) != 1)
81 ASSERT (0);
82 if (test1(-20) != 1)
83 ASSERT (0);
84 if (test1(-19) != 0)
85 ASSERT (0);
87 if (test2(0) != 1)
88 ASSERT (0);
89 if (test2(9) != 1)
90 ASSERT (0);
91 if (test2(10) != 0)
92 ASSERT (0);
93 if (test2(-1) != 1)
94 ASSERT (0);
95 if (test2(-9) != 1)
96 ASSERT (0);
97 if (test2(-10) != 0)
98 ASSERT (0);
100 if (test3(-30) != 1)
101 ASSERT (0);
102 if (test3(-29) != 0)
103 ASSERT (0);
104 if (test3(-20) != 0)
105 ASSERT (0);
106 if (test3(-19) != 1)
107 ASSERT (0);
109 if (test4(0) != 0)
110 ASSERT (0);
111 if (test4(9) != 0)
112 ASSERT (0);
113 if (test4(10) != 1)
114 ASSERT (0);
115 if (test4(-1) != 0)
116 ASSERT (0);
117 if (test4(-9) != 0)
118 ASSERT (0);
119 if (test4(-10) != 1)
120 ASSERT (0);
121 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
122 if (test5(-30) != 0)
123 ASSERT (0);
124 if (test5(-29) != 0)
125 ASSERT (0);
126 if (test5(-20) != 0)
127 ASSERT (0);
128 if (test5(-19) != 1)
129 ASSERT (0);
131 if (test6(0) != 0)
132 ASSERT (0);
133 if (test6(9) != 0)
134 ASSERT (0);
135 if (test6(10) != 1)
136 ASSERT (0);
137 if (test6(-1) != 0)
138 ASSERT (0);
139 if (test6(-9) != 0)
140 ASSERT (0);
141 if (test6(-10) != 0)
142 ASSERT (0);
144 if (test7(-30) != 0)
145 ASSERT (0);
146 if (test7(-29) != 1)
147 ASSERT (0);
148 if (test7(-20) != 1)
149 ASSERT (0);
150 if (test7(-19) != 1)
151 ASSERT (0);
152 #ifndef __SDCC_pdk14 // Lack of memory
153 if (test8(0) != 1)
154 ASSERT (0);
155 if (test8(9) != 1)
156 ASSERT (0);
157 if (test8(10) != 1)
158 ASSERT (0);
159 if (test8(-1) != 1)
160 ASSERT (0);
161 if (test8(-9) != 1)
162 ASSERT (0);
163 if (test8(-10) != 0)
164 ASSERT (0);
166 if (test9(-30) != 1)
167 ASSERT (0);
168 if (test9(-29) != 0)
169 ASSERT (0);
170 if (test9(-20) != 0)
171 ASSERT (0);
172 if (test9(-19) != 0)
173 ASSERT (0);
175 if (test10(0) != 0)
176 ASSERT (0);
177 if (test10(9) != 0)
178 ASSERT (0);
179 if (test10(10) != 0)
180 ASSERT (0);
181 if (test10(-1) != 0)
182 ASSERT (0);
183 if (test10(-9) != 0)
184 ASSERT (0);
185 if (test10(-10) != 1)
186 ASSERT (0);
188 if (test11(-30) != 1)
189 ASSERT (0);
190 if (test11(-29) != 1)
191 ASSERT (0);
192 if (test11(-20) != 1)
193 ASSERT (0);
194 if (test11(-19) != 0)
195 ASSERT (0);
197 if (test12(0) != 1)
198 ASSERT (0);
199 if (test12(9) != 1)
200 ASSERT (0);
201 if (test12(10) != 0)
202 ASSERT (0);
203 if (test12(-1) != 1)
204 ASSERT (0);
205 if (test12(-9) != 1)
206 ASSERT (0);
207 if (test12(-10) != 1)
208 ASSERT (0);
209 #endif
210 #endif
211 return;