struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-950704-1.c
blobb4ef806a7298dbb0bf126d15dfd90f7c517b6b17
1 /*
2 950704-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 int errflag;
15 long long
16 f (long long x, long long y)
18 long long r;
20 errflag = 0;
21 r = x + y;
22 if (x >= 0)
24 if ((y < 0) || (r >= 0))
25 return r;
27 else
29 if ((y > 0) || (r < 0))
30 return r;
32 errflag = 1;
33 return 0;
35 #endif
37 void
38 testTortureExecute (void)
40 #if !defined(__SDCC_pdk14) // Lack of memory
41 f (0, 0);
42 if (errflag)
43 ASSERT (0);
45 f (1, -1);
46 if (errflag)
47 ASSERT (0);
49 f (-1, 1);
50 if (errflag)
51 ASSERT (0);
53 f (0x8000000000000000LL, 0x8000000000000000LL);
54 if (!errflag)
55 ASSERT (0);
57 f (0x8000000000000000LL, -1LL);
58 if (!errflag)
59 ASSERT (0);
61 f (0x7fffffffffffffffLL, 0x7fffffffffffffffLL);
62 if (!errflag)
63 ASSERT (0);
65 f (0x7fffffffffffffffLL, 1LL);
66 if (!errflag)
67 ASSERT (0);
69 f (0x7fffffffffffffffLL, 0x8000000000000000LL);
70 if (errflag)
71 ASSERT (0);
73 return;
74 #endif