struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr40057.c
blob37d50deed4462303392838e33f4af187169ea4f4
1 /*
2 pr40057.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 // TODO: Enable when sdcc supports long long in these ports!
12 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
13 /* PR middle-end/40057 */
15 int
16 foo (unsigned long long x)
18 unsigned long long y = (x >> 31ULL) & 1ULL;
19 if (y == 0ULL)
20 return 0;
21 return -1;
24 int
25 bar (long long x)
27 long long y = (x >> 31LL) & 1LL;
28 if (y == 0LL)
29 return 0;
30 return -1;
32 #endif
34 void
35 testTortureExecute (void)
37 #ifndef PORT_HOST // Fails on NetBSD
38 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
39 if (sizeof (long long) != 8)
40 return;
41 if (foo (0x1682a9aaaULL))
42 ASSERT (0);
43 if (!foo (0x1882a9aaaULL))
44 ASSERT (0);
45 if (bar (0x1682a9aaaLL))
46 ASSERT (0);
47 if (!bar (0x1882a9aaaLL))
48 ASSERT (0);
49 return;
50 #endif
51 #endif