1 /** bug-3788.c: The value of a write to a bit-field in a union member was used as read value for another union member.
7 BITS_RESERVED_0
= 0x1, BITS_RESERVED_1
= 0x2,
8 BITS_RESERVED_2
= 0x4, BITS_RESERVED_3
= 0x8,
9 MYBIT4
= 0x10, MYBIT5
= 0x20,
10 BITS_RESERVED_6
= 0x40, BITS_RESERVED_7
= 0x80 };
14 unsigned char BITS_RESERVED_0
: 1;
15 unsigned char BITS_RESERVED_1
: 1;
16 unsigned char BITS_RESERVED_2
: 1;
17 unsigned char BITS_RESERVED_3
: 1;
18 unsigned char MYBIT4
: 1;
19 unsigned char MYBIT5
: 1;
20 unsigned char BITS_RESERVED_6
: 1;
21 unsigned char BITS_RESERVED_7
: 1;
26 void print_special( unsigned char c
);
28 void send_loop_try( unsigned char c
)
30 (g_bits
).a
.MYBIT5
= 1;;
31 if ( ((MYBIT4
) & (g_bits
).is
) ) // The read of (g_bits).is was incorrectly optimized into a constant 1.
35 unsigned char d
= 0x5a;
39 (g_bits
).a
.MYBIT4
= 1;;
40 send_loop_try( 0xa5 );
41 // The order of allocation of bit-fields within a unit
42 // (high-order to low-order or low-order to high-order) is
43 // implementation-defined. This test assumes the SDCC order,
44 // It fails e.g. for powerpc64-linux-gnu.
50 void print_special( unsigned char c
)