PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / divcmp-1.c
blob0a7f305aa7c0c7d08acaff56f9b27e068fafff7d
1 extern void abort(void);
3 int test1(int x)
5 return x/10 == 2;
8 int test1u(unsigned int x)
10 return x/10U == 2;
13 int test2(int x)
15 return x/10 == 0;
18 int test2u(unsigned int x)
20 return x/10U == 0;
23 int test3(int x)
25 return x/10 != 2;
28 int test3u(unsigned int x)
30 return x/10U != 2;
33 int test4(int x)
35 return x/10 != 0;
38 int test4u(unsigned int x)
40 return x/10U != 0;
43 int test5(int x)
45 return x/10 < 2;
48 int test5u(unsigned int x)
50 return x/10U < 2;
53 int test6(int x)
55 return x/10 < 0;
58 int test7(int x)
60 return x/10 <= 2;
63 int test7u(unsigned int x)
65 return x/10U <= 2;
68 int test8(int x)
70 return x/10 <= 0;
73 int test8u(unsigned int x)
75 return x/10U <= 0;
78 int test9(int x)
80 return x/10 > 2;
83 int test9u(unsigned int x)
85 return x/10U > 2;
88 int test10(int x)
90 return x/10 > 0;
93 int test10u(unsigned int x)
95 return x/10U > 0;
98 int test11(int x)
100 return x/10 >= 2;
103 int test11u(unsigned int x)
105 return x/10U >= 2;
108 int test12(int x)
110 return x/10 >= 0;
114 int main()
116 if (test1(19) != 0)
117 abort ();
118 if (test1(20) != 1)
119 abort ();
120 if (test1(29) != 1)
121 abort ();
122 if (test1(30) != 0)
123 abort ();
125 if (test1u(19) != 0)
126 abort ();
127 if (test1u(20) != 1)
128 abort ();
129 if (test1u(29) != 1)
130 abort ();
131 if (test1u(30) != 0)
132 abort ();
134 if (test2(0) != 1)
135 abort ();
136 if (test2(9) != 1)
137 abort ();
138 if (test2(10) != 0)
139 abort ();
140 if (test2(-1) != 1)
141 abort ();
142 if (test2(-9) != 1)
143 abort ();
144 if (test2(-10) != 0)
145 abort ();
147 if (test2u(0) != 1)
148 abort ();
149 if (test2u(9) != 1)
150 abort ();
151 if (test2u(10) != 0)
152 abort ();
153 if (test2u(-1) != 0)
154 abort ();
155 if (test2u(-9) != 0)
156 abort ();
157 if (test2u(-10) != 0)
158 abort ();
160 if (test3(19) != 1)
161 abort ();
162 if (test3(20) != 0)
163 abort ();
164 if (test3(29) != 0)
165 abort ();
166 if (test3(30) != 1)
167 abort ();
169 if (test3u(19) != 1)
170 abort ();
171 if (test3u(20) != 0)
172 abort ();
173 if (test3u(29) != 0)
174 abort ();
175 if (test3u(30) != 1)
176 abort ();
178 if (test4(0) != 0)
179 abort ();
180 if (test4(9) != 0)
181 abort ();
182 if (test4(10) != 1)
183 abort ();
184 if (test4(-1) != 0)
185 abort ();
186 if (test4(-9) != 0)
187 abort ();
188 if (test4(-10) != 1)
189 abort ();
191 if (test4u(0) != 0)
192 abort ();
193 if (test4u(9) != 0)
194 abort ();
195 if (test4u(10) != 1)
196 abort ();
197 if (test4u(-1) != 1)
198 abort ();
199 if (test4u(-9) != 1)
200 abort ();
201 if (test4u(-10) != 1)
202 abort ();
204 if (test5(19) != 1)
205 abort ();
206 if (test5(20) != 0)
207 abort ();
208 if (test5(29) != 0)
209 abort ();
210 if (test5(30) != 0)
211 abort ();
213 if (test5u(19) != 1)
214 abort ();
215 if (test5u(20) != 0)
216 abort ();
217 if (test5u(29) != 0)
218 abort ();
219 if (test5u(30) != 0)
220 abort ();
222 if (test6(0) != 0)
223 abort ();
224 if (test6(9) != 0)
225 abort ();
226 if (test6(10) != 0)
227 abort ();
228 if (test6(-1) != 0)
229 abort ();
230 if (test6(-9) != 0)
231 abort ();
232 if (test6(-10) != 1)
233 abort ();
235 if (test7(19) != 1)
236 abort ();
237 if (test7(20) != 1)
238 abort ();
239 if (test7(29) != 1)
240 abort ();
241 if (test7(30) != 0)
242 abort ();
244 if (test7u(19) != 1)
245 abort ();
246 if (test7u(20) != 1)
247 abort ();
248 if (test7u(29) != 1)
249 abort ();
250 if (test7u(30) != 0)
251 abort ();
253 if (test8(0) != 1)
254 abort ();
255 if (test8(9) != 1)
256 abort ();
257 if (test8(10) != 0)
258 abort ();
259 if (test8(-1) != 1)
260 abort ();
261 if (test8(-9) != 1)
262 abort ();
263 if (test8(-10) != 1)
264 abort ();
266 if (test8u(0) != 1)
267 abort ();
268 if (test8u(9) != 1)
269 abort ();
270 if (test8u(10) != 0)
271 abort ();
272 if (test8u(-1) != 0)
273 abort ();
274 if (test8u(-9) != 0)
275 abort ();
276 if (test8u(-10) != 0)
277 abort ();
279 if (test9(19) != 0)
280 abort ();
281 if (test9(20) != 0)
282 abort ();
283 if (test9(29) != 0)
284 abort ();
285 if (test9(30) != 1)
286 abort ();
288 if (test9u(19) != 0)
289 abort ();
290 if (test9u(20) != 0)
291 abort ();
292 if (test9u(29) != 0)
293 abort ();
294 if (test9u(30) != 1)
295 abort ();
297 if (test10(0) != 0)
298 abort ();
299 if (test10(9) != 0)
300 abort ();
301 if (test10(10) != 1)
302 abort ();
303 if (test10(-1) != 0)
304 abort ();
305 if (test10(-9) != 0)
306 abort ();
307 if (test10(-10) != 0)
308 abort ();
310 if (test10u(0) != 0)
311 abort ();
312 if (test10u(9) != 0)
313 abort ();
314 if (test10u(10) != 1)
315 abort ();
316 if (test10u(-1) != 1)
317 abort ();
318 if (test10u(-9) != 1)
319 abort ();
320 if (test10u(-10) != 1)
321 abort ();
323 if (test11(19) != 0)
324 abort ();
325 if (test11(20) != 1)
326 abort ();
327 if (test11(29) != 1)
328 abort ();
329 if (test11(30) != 1)
330 abort ();
332 if (test11u(19) != 0)
333 abort ();
334 if (test11u(20) != 1)
335 abort ();
336 if (test11u(29) != 1)
337 abort ();
338 if (test11u(30) != 1)
339 abort ();
341 if (test12(0) != 1)
342 abort ();
343 if (test12(9) != 1)
344 abort ();
345 if (test12(10) != 1)
346 abort ();
347 if (test12(-1) != 1)
348 abort ();
349 if (test12(-9) != 1)
350 abort ();
351 if (test12(-10) != 0)
352 abort ();
354 return 0;