struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020423-1.c
blob0ebbc578a4eb69c9d32ec6cebc43fe6e2156c3cf
1 /*
2 20020423-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 /* PR c/5430 */
12 /* Verify that the multiplicative folding code is not fooled
13 by the mix between signed variables and unsigned constants. */
15 void testTortureExecute (void)
17 int my_int = 924;
18 unsigned int result;
20 result = ((my_int*2 + 4) - 8U) / 2;
21 if (result != 922U)
22 ASSERT (0);
24 result = ((my_int*2 - 4U) + 2) / 2;
25 if (result != 923U)
26 ASSERT (0);
28 result = (((my_int + 2) * 2) - 8U - 4) / 2;
29 if (result != 920U)
30 ASSERT (0);
31 result = (((my_int + 2) * 2) - (8U + 4)) / 2;
32 if (result != 920U)
33 ASSERT (0);
35 result = ((my_int*4 + 2U) - 4U) / 2;
36 if (result != 1847U)
37 ASSERT (0);
39 return;