struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2216.c
blob2f112be95d22b3f30203c9e5c0b09655532fe5d4
1 /* bug-2216.c
2 */
4 #include <testfwk.h>
6 #define BIG_ARRAY ((__xdata volatile unsigned char *)0x8000) // XDATA Memory
8 typedef __data union
10 struct
12 unsigned char bit0 : 1;
13 unsigned char bit1 : 1;
14 unsigned char bit2 : 1;
15 unsigned char bit3 : 1;
16 unsigned char bit4 : 1;
17 unsigned char bit5 : 1;
18 unsigned char bit6 : 1;
19 unsigned char bit7 : 1;
20 } bits;
21 unsigned char byte;
22 } byte_in_bit_memory;
24 byte_in_bit_memory __at (0x20) first_byte;
26 __data unsigned char __at (0x21) dummy_byte;
28 /* This failed with: Internal error: validateOpType failed in
29 OP_SYMBOL(IC_RESULT (ic)) @ SDCCptropt.c:335: expected symbol, got value */
30 void foo(void)
32 BIG_ARRAY[0] = first_byte.byte;
35 void bar(void)
37 BIG_ARRAY[0] = dummy_byte;
40 void testBug(void)
42 ASSERT(1);