struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2539.c
blobb702cd0e6ca80f4b945abe0f2fc52f77290c04bc
1 /*
2 bug-2539.c
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 struct sBITS {
10 unsigned b0 : 1;
11 unsigned b1 : 1;
12 unsigned b2 : 1;
13 unsigned b3 : 1;
14 unsigned b4 : 1;
15 unsigned b5 : 1;
16 unsigned b6 : 1;
17 unsigned b7 : 1;
19 struct sBITS vb;
21 void SetIf(uint8_t x)
23 vb.b3 = (x != 0); // only bit 0 of 'x' testet
26 void testBug(void)
28 SetIf(0);
30 ASSERT(!vb.b3);
32 SetIf(24);
34 ASSERT(vb.b3);