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-950512-1.c
blobef2b7bdb69e80c83646c60ebf0b3bb109ed72a46
1 /*
2 950512-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)
14 unsigned
15 f1 (int x)
17 return ((unsigned) (x != 0) - 3) / 2;
20 unsigned long long
21 f2 (int x)
23 return ((unsigned long long) (x != 0) - 3) / 2;
25 #endif
27 void
28 testTortureExecute (void)
30 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
31 if (f1 (1) != (~(unsigned) 0) >> 1)
32 ASSERT (0);
33 if (f1 (0) != ((~(unsigned) 0) >> 1) - 1)
34 ASSERT (0);
35 if (f2 (1) != (~(unsigned long long) 0) >> 1)
36 ASSERT (0);
37 if (f2 (0) != ((~(unsigned long long) 0) >> 1) - 1)
38 ASSERT (0);
39 return;
40 #endif