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-20071216-1.c
blob24210e24c151d8d8c2d32abf405b1c4ee070c328
1 /*
2 20071216-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR rtl-optimization/34490 */
13 static int x;
15 int
16 bar (void)
18 return x;
21 int
22 foo (void)
24 long int b = bar ();
25 if ((unsigned long) b < -4095L)
26 return b;
27 if (-b != 38)
28 b = -2;
29 return b + 1;
32 void
33 testTortureExecute (void)
35 x = 26;
36 if (foo () != 26)
37 ASSERT (0);
38 x = -39;
39 if (foo () != -1)
40 ASSERT (0);
41 x = -38;
42 if (foo () != -37)
43 ASSERT (0);
44 return;