struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3102.c
blob37a63fd7cce9596cb0bf9e24f5528dec7c269816
1 /* bug-3102.c
2 A problem in the interaction of two peephole rules with rare code and an assembler quirk.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma disable_warning 85
9 #endif
11 static unsigned char Flag[10];
12 static unsigned char Object[10];
14 #define CARRIED (Flag[2])
15 #define WORN (Flag[3])
17 static void Message(unsigned char m)
21 static void DropItem(void)
25 static void Put(unsigned char obj, unsigned char loc)
29 static void Wear(unsigned char obj)
31 if (Object[obj] == WORN) {
32 Message(29);
33 return;
35 if (Object[obj] != CARRIED) {
36 Message(23);
37 return;
39 DropItem();
40 Put(obj, WORN);
43 void
44 testBug(void)
46 Wear(0);