Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-compare-2.c
blob5b72148dc83599f52fa8a860d42f5c1fa1690ead
1 /*
2 compare-2.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 /* Copyright (C) 2002 Free Software Foundation.
13 Ensure that the composite comparison optimization doesn't misfire
14 and attempt to combine a signed comparison with an unsigned one.
16 Written by Roger Sayle, 3rd June 2002. */
18 extern void abort (void);
20 int
21 foo (int x, int y)
23 /* If miscompiled the following may become "x == y". */
24 return (x<=y) && ((unsigned int)x >= (unsigned int)y);
27 void
28 testTortureExecute (void)
30 if (! foo (-1,0))
31 ASSERT (0);
32 return;