struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020614-1.c
blob4aaab7d51134fb561840f23fe72771b63e1a0aef
1 /*
2 20020614-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/6677 */
12 /* Verify that GCC doesn't perform illegal simplifications
13 when folding constants. */
15 #include <limits.h>
17 void testTortureExecute (void)
19 int i;
20 signed char j;
21 unsigned char k;
23 i = SCHAR_MAX;
25 j = ((signed char) (i << 1)) / 2;
27 if (j != -1)
28 ASSERT (0);
30 j = ((signed char) (i * 2)) / 2;
32 if (j != -1)
33 ASSERT (0);
35 i = UCHAR_MAX;
37 k = ((unsigned char) (i << 1)) / 2;
39 if (k != UCHAR_MAX/2)
40 ASSERT (0);
42 k = ((unsigned char) (i * 2)) / 2;
44 if (k != UCHAR_MAX/2)
45 ASSERT (0);
47 return;