struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-921029-1.c
blobfe6816b4abf8e8adbe44f78c9021c35b2b72a02a
1 /*
2 921029-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 // TODO: Enable when sdcc supports long long in these ports!
12 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
13 typedef unsigned long long ULL;
14 ULL back;
15 ULL hpart, lpart;
16 ULL
17 build(long h, long l)
19 hpart = h;
20 hpart <<= 32;
21 lpart = l;
22 lpart &= 0xFFFFFFFFLL;
23 back = hpart | lpart;
24 return back;
26 #endif
28 void
29 testTortureExecute (void)
31 #if !defined(__SDCC_pdk14) // Lack of memory
32 if (build(0, 1) != 0x0000000000000001LL)
33 ASSERT(0);
34 if (build(0, 0) != 0x0000000000000000LL)
35 ASSERT(0);
36 if (build(0, 0xFFFFFFFF) != 0x00000000FFFFFFFFLL)
37 ASSERT(0);
38 if (build(0, 0xFFFFFFFE) != 0x00000000FFFFFFFELL)
39 ASSERT(0);
40 if (build(1, 1) != 0x0000000100000001LL)
41 ASSERT(0);
42 if (build(1, 0) != 0x0000000100000000LL)
43 ASSERT(0);
44 if (build(1, 0xFFFFFFFF) != 0x00000001FFFFFFFFLL)
45 ASSERT(0);
46 if (build(1, 0xFFFFFFFE) != 0x00000001FFFFFFFELL)
47 ASSERT(0);
48 if (build(0xFFFFFFFF, 1) != 0xFFFFFFFF00000001LL)
49 ASSERT(0);
50 if (build(0xFFFFFFFF, 0) != 0xFFFFFFFF00000000LL)
51 ASSERT(0);
52 if (build(0xFFFFFFFF, 0xFFFFFFFF) != 0xFFFFFFFFFFFFFFFFLL)
53 ASSERT(0);
54 if (build(0xFFFFFFFF, 0xFFFFFFFE) != 0xFFFFFFFFFFFFFFFELL)
55 ASSERT(0);
56 return;
57 #endif