struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr16790-1.c
blob8b350aa3d6706b9bd4f177d1fda234edebca4dbc
1 /*
2 pr16790-1.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 /* PR middle-end/16790. */
13 extern void abort ();
15 static void test1(unsigned int u1)
17 unsigned int y_final_1;
18 signed short y_middle;
19 unsigned int y_final_2;
21 y_final_1 = (unsigned int)( (signed short)(u1 * 2) * 3 );
22 y_middle = (signed short)(u1 * 2);
23 y_final_2 = (unsigned int)( y_middle * 3 );
25 if (y_final_1 != y_final_2)
26 ASSERT (0);
30 static void test2(unsigned int u1)
32 unsigned int y_final_1;
33 signed short y_middle;
34 unsigned int y_final_2;
36 y_final_1 = (unsigned int)( (signed short)(u1 << 1) * 3 );
37 y_middle = (signed short)(u1 << 1);
38 y_final_2 = (unsigned int)( y_middle * 3 );
40 if (y_final_1 != y_final_2)
41 ASSERT (0);
45 void
46 testTortureExecute (void)
48 test1(0x4000U);
49 test2(0x4000U);
50 return;