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-20180112-1.c
blob28e50f7936fe1b9be526011dad5ff9823a33d6b7
1 /*
2 20180112-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 /* PR rtl-optimization/83565 */
10 /* Testcase by Sergei Trofimovich <slyfox@inbox.ru> */
12 typedef uint32_t u32;
14 u32 bug (u32 * result);
15 u32 bug (u32 * result)
17 volatile u32 ss = 0xFFFFffff;
18 volatile u32 d = 0xEEEEeeee;
19 u32 tt = d & 0x00800000;
20 u32 r = tt << 8;
22 r = (r >> 31) | (r << 1);
24 u32 u = r^ss;
25 u32 off = u >> 1;
27 *result = tt;
28 return off;
31 void
32 testTortureExecute (void)
34 #ifndef __SDCC_pdk14 // Lack of memory
35 u32 l;
36 u32 off = bug(&l);
37 if (off != 0x7fffffff)
38 ASSERT (0);
39 return;
40 #endif