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-pr69097-2.c
blobf4a7cb712866b82aca1e781a206b59d9cfa7346c
1 /*
2 pr69097-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 #include <limits.h>
13 /* PR tree-optimization/69097 */
15 int
16 f1 (int x, int y)
18 return x % y;
21 int
22 f2 (int x, int y)
24 return x % -y;
27 int
28 f3 (int x, int y)
30 int z = -y;
31 return x % z;
34 void
35 testTortureExecute (void)
37 if (f1 (-INT_MAX - 1, 1) != 0
38 || f2 (-INT_MAX - 1, -1) != 0
39 || f3 (-INT_MAX - 1, -1) != 0)
40 ASSERT(0);
41 return;