struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2929.c
blob695df97d9f59d9799d2d3e4d43ece71df30d6d52
1 /*
2 bug-2929.c
4 A bug in z80 code generation for ~.
5 */
7 #include <testfwk.h>
9 volatile unsigned char c;
10 unsigned int i;
12 void f(void)
14 unsigned int j = (unsigned char)(c + 1);
15 i = ~j | 0xaa55;
18 void testBug(void)
20 c = 0xff;
21 f();
22 ASSERT((i & 0xffffu) == 0xffffu);
24 c = 0x00;
25 f();
26 ASSERT((i & 0xffffu) == 0xffffu);
28 c = 0xfe;
29 f();
30 ASSERT((i & 0xffffu) == 0xff55u);