struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-950612-1.c
blob35432c867886fd31c01c0e38c24693a3d9b2a5db
1 /*
2 950612-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 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16) && !defined(__SDCC_pdk14)
12 unsigned int
13 f1 (int diff)
15 return ((unsigned int) (diff < 0 ? -diff : diff));
18 unsigned int
19 f2 (unsigned int diff)
21 return ((unsigned int) ((signed int) diff < 0 ? -diff : diff));
24 unsigned long long
25 f3 (long long diff)
27 return ((unsigned long long) (diff < 0 ? -diff : diff));
30 unsigned long long
31 f4 (unsigned long long diff)
33 return ((unsigned long long) ((signed long long) diff < 0 ? -diff : diff));
35 #endif
37 void
38 testTortureExecute (void)
40 #if !defined(__SDCC_ds390) && !defined(__SDCC_pic14) && !defined(__SDCC_pic16) && !defined(__SDCC_pdk14)
41 int i;
42 for (i = 0; i <= 10; i++)
44 if (f1 (i) != i)
45 ASSERT (0);
46 if (f1 (-i) != i)
47 ASSERT (0);
48 if (f2 (i) != i)
49 ASSERT (0);
50 if (f2 (-i) != i)
51 ASSERT (0);
52 if (f3 ((long long) i) != i)
53 ASSERT (0);
54 if (f3 ((long long) -i) != i)
55 ASSERT (0);
56 if (f4 ((long long) i) != i)
57 ASSERT (0);
58 if (f4 ((long long) -i) != i)
59 ASSERT (0);
61 return;
62 #endif