struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-960311-2.c
blob993db96d3ffa5f7d66d51e2d6dab859d3381e012
1 /*
2 960311-2.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 #include <stdio.h>
13 int count;
15 void a1() { ++count; }
17 void
18 b (unsigned short data)
20 if (data & 0x8000) a1();
21 data <<= 1;
23 if (data & 0x8000) a1();
24 data <<= 1;
26 if (data & 0x8000) a1();
29 void
30 testTortureExecute (void)
32 count = 0;
33 b (0);
34 if (count != 0)
35 ASSERT (0);
37 count = 0;
38 b (0x8000);
39 if (count != 1)
40 ASSERT (0);
42 count = 0;
43 b (0x4000);
44 if (count != 1)
45 ASSERT (0);
47 count = 0;
48 b (0x2000);
49 if (count != 1)
50 ASSERT (0);
52 count = 0;
53 b (0xc000);
54 if (count != 2)
55 ASSERT (0);
57 count = 0;
58 b (0xa000);
59 if (count != 2)
60 ASSERT (0);
62 count = 0;
63 b (0x6000);
64 if (count != 2)
65 ASSERT (0);
67 count = 0;
68 b (0xe000);
69 if (count != 3)
70 ASSERT (0);
72 return;