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-pr65215-2.c
blob9c493cb7c0320dde171d7e0485c51fbbda25c6fb
1 /*
2 pr65215-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/65215 */
15 static inline unsigned int
16 foo (unsigned int x)
18 return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
21 unsigned long long
22 bar (unsigned long long *x)
24 return ((unsigned long long) foo (*x) << 32) | foo (*x >> 32);
27 void
28 testTortureExecute (void)
30 if (CHAR_BIT != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
31 return;
32 unsigned long long l = foo (0xfeedbea8U) | ((unsigned long long) foo (0xdeadbeefU) << 32);
33 if (bar (&l) != 0xfeedbea8deadbeefULL)
34 ASSERT (0);
35 return;