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-pr47148.c
blob187a83d3155f0bd3f3028a8e8d9ef2fde4e9d8e2
1 /*
2 pr47148.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 /* PR tree-optimization/47148 */
13 static inline unsigned
14 bar (unsigned x, unsigned y)
16 if (y >= 32)
17 return x;
18 else
19 return x >> y;
22 static unsigned a = 1, b = 1;
24 static inline void
25 foo (unsigned char x, unsigned y)
27 if (!y)
28 return;
29 unsigned c = (0x7000U / (x - 2)) ^ a;
30 unsigned d = bar (a, a);
31 b &= ((a - d) && (a - 1)) + c;
34 void
35 testTortureExecute (void)
37 foo (1, 1);
38 foo (-1, 1);
39 if (b && ((unsigned char) -1) == 255)
40 ASSERT (0);
41 return;