1 /*
2 20180112-1.c from the execute part of the gcc torture tests.
3 */
4 
5 #include <testfwk.h>
6 
7 #include <stdint.h>
8 
9 /* PR rtl-optimization/83565 */
10 /* Testcase by Sergei Trofimovich <slyfox@inbox.ru> */
11 
12 typedef uint32_t u32;
13 
14 u32 bug (u32 * result);
bug(u32 * result)15 u32 bug (u32 * result)
16 {
17   volatile u32 ss = 0xFFFFffff;
18   volatile u32 d  = 0xEEEEeeee;
19   u32 tt = d & 0x00800000;
20   u32 r  = tt << 8;
21 
22   r = (r >> 31) | (r <<  1);
23 
24   u32 u = r^ss;
25   u32 off = u >> 1;
26 
27   *result = tt;
28   return off;
29 }
30 
31 void
testTortureExecute(void)32 testTortureExecute (void)
33 {
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
41 }
42