struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050111-1.c
blob51657e778df21c162ab6559e3587e4ed1fdab631
1 /*
2 20050111-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 // Some ports do not yet support long long
12 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
14 /* PR middle-end/19084, rtl-optimization/19348 */
16 unsigned int
17 foo (unsigned long long x)
19 unsigned int u;
21 if (x == 0)
22 return 0;
23 u = (unsigned int) (x >> 32);
24 return u;
27 unsigned long long
28 bar (unsigned short x)
30 return (unsigned long long) x << 32;
32 #endif
34 void
35 testTortureExecute (void)
37 // Some ports do not yet support long long
38 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
40 if (sizeof (long long) != 8)
41 return;
43 if (foo (0) != 0)
44 ASSERT (0);
46 if (foo (0xffffffffULL) != 0)
47 ASSERT (0);
48 if (foo (0x25ff00ff00ULL) != 0x25)
49 ASSERT (0);
50 if (bar (0) != 0)
51 ASSERT (0);
52 if (bar (0x25) != 0x2500000000ULL)
53 ASSERT (0);
54 return;
55 #endif