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