| 1 |
/* Copyright (C) 2002 Free Software Foundation. |
| 2 |
|
| 3 |
Ensure that the composite comparison optimization doesn't misfire |
| 4 |
and attempt to combine a signed comparison with an unsigned one. |
| 5 |
|
| 6 |
Written by Roger Sayle, 3rd June 2002. */ |
| 7 |
|
| 8 |
extern void abort (void); |
| 9 |
|
| 10 |
int |
| 11 |
foo (int x, int y) |
| 12 |
{ |
| 13 |
/* If miscompiled the following may become "x == y". */ |
| 14 |
return (x<=y) && ((unsigned int)x >= (unsigned int)y); |
| 15 |
} |
| 16 |
|
| 17 |
int |
| 18 |
main () |
| 19 |
{ |
| 20 |
if (! foo (-1,0)) |
| 21 |
abort (); |
| 22 |
return 0; |
| 23 |
} |
| 24 |
|