OSDN Git Service

testsuite/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / pr45262.c
1 /* PR middle-end/45262 */
2
3 extern void abort (void);
4
5 int
6 foo (unsigned int x)
7 {
8   return ((int) x < 0) || ((int) (-x) < 0);
9 }
10
11 int
12 bar (unsigned int x)
13 {
14   return x >> 31 || (-x) >> 31;
15 }
16
17 int
18 main (void)
19 {
20   if (foo (1) != 1)
21     abort ();
22   if (foo (0) != 0)
23     abort ();
24   if (foo (-1) != 1)
25     abort ();
26   if (bar (1) != 1)
27     abort ();
28   if (bar (0) != 0)
29     abort ();
30   if (bar (-1) != 1)
31     abort ();
32   return 0;
33 }