Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp63.c
blob9116847de53e9f61008f4353ebfb4e986d8420b1
1 /* PR tree-optimization/51721 */
2 /* { dg-do link } */
3 /* { dg-options "-O2" } */
5 extern void link_error (void);
7 #define BITSM1 (sizeof (int) * __CHAR_BIT__ - 1)
9 void
10 f1 (unsigned int s)
12 if (s >> 1 == 0)
14 if (s == 2 || s == -1U)
15 link_error ();
17 else
19 if (s == 0 || s == 1)
20 link_error ();
24 void
25 f2 (unsigned int s)
27 if (s >> 4 != 3)
29 if (s == 48 || s == 57 || s == 63)
30 link_error ();
32 else
34 if (s == 47 || s == 64 || s == 0 || s == -1U)
35 link_error ();
39 void
40 f3 (int s)
42 if (s >> 3 == -2)
44 if (s == -17 || s == -8 || s == 0
45 || s == -__INT_MAX__ - 1 || s == __INT_MAX__)
46 link_error ();
48 else
50 if (s == -16 || s == -12 || s == -9)
51 link_error ();
55 void
56 f4 (unsigned int s)
58 if (s >> 2 < 4)
60 if (s == 16 || s == 20 || s == -1U)
61 link_error ();
63 else
65 if (s == 0 || s == 2 || s == 14 || s == 15)
66 link_error ();
70 void
71 f5 (unsigned int s)
73 if (s >> 3 <= 7)
75 if (s == 64 || s == 68 || s == -1U)
76 link_error ();
78 else
80 if (s == 0 || s == 1 || s == 62 || s == 63)
81 link_error ();
85 void
86 f6 (unsigned int s)
88 if (s >> 1 > 2)
90 if (s == 0 || s == 3 || s == 5)
91 link_error ();
93 else
95 if (s == 6 || s == 8 || s == -1U)
96 link_error ();
100 void
101 f7 (unsigned int s)
103 if (s >> 5 >= 7)
105 if (s == 0 || s == 2 || s == 221 || s == 223)
106 link_error ();
108 else
110 if (s == 224 || s == 256 || s == 258 || s == -1U)
111 link_error ();
115 void
116 f8 (int s)
118 if (s >> 2 < -3)
120 if (s == -12 || s == -10 || s == 0 || s == __INT_MAX__)
121 link_error ();
123 else
125 if (s == -13 || s == -16 || s == -__INT_MAX__ - 1)
126 link_error ();
130 void
131 f9 (int s)
133 if (s >> 3 <= -2)
135 if (s == -8 || s == -6 || s == 0 || s == __INT_MAX__)
136 link_error ();
138 else
140 if (s == -9 || s == -11 || s == -__INT_MAX__ - 1)
141 link_error ();
145 void
146 f10 (int s)
148 if (s >> 1 > -4)
150 if (s == -7 || s == -9 || s == -__INT_MAX__ - 1)
151 link_error ();
153 else
155 if (s == -6 || s == -4 || s == 0 || s == __INT_MAX__)
156 link_error ();
160 void
161 f11 (int s)
163 if (s >> 3 >= -6)
165 if (s == -49 || s == -51 || s == -__INT_MAX__ - 1)
166 link_error ();
168 else
170 if (s == -48 || s == -46 || s == 0 || s == __INT_MAX__)
171 link_error ();
175 void
176 f12 (int s)
178 if (s >> 2 < 4)
180 if (s == 16 || s == 20 || s == __INT_MAX__)
181 link_error ();
183 else
185 if (s == 0 || s == 2 || s == 14 || s == 15
186 || s == -2 || s == -__INT_MAX__ - 1)
187 link_error ();
191 void
192 f13 (int s)
194 if (s >> 3 <= 7)
196 if (s == 64 || s == 68 || s == __INT_MAX__)
197 link_error ();
199 else
201 if (s == 0 || s == 1 || s == 62 || s == 63
202 || s == -2 || s == -__INT_MAX__ - 1)
203 link_error ();
207 void
208 f14 (int s)
210 if (s >> 1 > 2)
212 if (s == 0 || s == 3 || s == 5
213 || s == -2 || s == -__INT_MAX__ - 1)
214 link_error ();
216 else
218 if (s == 6 || s == 8 || s == __INT_MAX__)
219 link_error ();
223 void
224 f15 (int s)
226 if (s >> 5 >= 7)
228 if (s == 0 || s == 2 || s == 221 || s == 223
229 || s == -2 || s == -__INT_MAX__ - 1)
230 link_error ();
232 else
234 if (s == 224 || s == 256 || s == 258 || s == __INT_MAX__)
235 link_error ();
239 unsigned int
240 f16 (unsigned int s)
242 unsigned int t = s >> BITSM1;
243 if (t != 0)
245 if (s == 0 || s == 5 || s == __INT_MAX__)
246 link_error ();
248 else
250 if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
251 link_error ();
253 return t;
257 f17 (int s)
259 int t = s >> BITSM1;
260 if (t == 0)
262 if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
263 link_error ();
265 else
267 if (s == 0 || s == 5 || s == __INT_MAX__)
268 link_error ();
270 return t;
273 unsigned int
274 f18 (unsigned int s)
276 unsigned int t = s >> BITSM1;
277 if (t >= 1)
279 if (s == 0 || s == 5 || s == __INT_MAX__)
280 link_error ();
282 else
284 if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
285 link_error ();
287 return t;
291 f19 (int s)
293 int t = s >> BITSM1;
294 if (t >= 0)
296 if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
297 link_error ();
299 else
301 if (s == 0 || s == 5 || s == __INT_MAX__)
302 link_error ();
304 return t;
307 unsigned int
308 f20 (unsigned int s)
310 unsigned int t = s >> BITSM1;
311 if (t < 1)
313 if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
314 link_error ();
316 else
318 if (s == 0 || s == 5 || s == __INT_MAX__)
319 link_error ();
321 return t;
325 f21 (int s)
327 int t = s >> BITSM1;
328 if (t < 0)
330 if (s == 0 || s == 5 || s == __INT_MAX__)
331 link_error ();
333 else
335 if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
336 link_error ();
338 return t;
342 main ()
344 return 0;