Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2750.c
blobbba64b3ef0d1f9f50f444b5da21d235a2abde7ce
1 /*
2 bug1-2195.c
4 frontend used | in place of ^.
5 */
7 #include <testfwk.h>
9 typedef struct
11 unsigned LATC0 : 1;
12 unsigned LATC1 : 1;
13 unsigned LATC2 : 1;
14 unsigned LATC3 : 1;
15 unsigned LATC4 : 1;
16 unsigned LATC5 : 1;
17 unsigned LATC6 : 1;
18 unsigned LATC7 : 1;
19 } LATCbits_t;
21 #if defined(__SDCC_pic14) // pic14: LATCbits may actually exist in the device
22 # define LATCbits fake_LATCbits
23 #endif
25 volatile LATCbits_t LATCbits;
27 unsigned short mask;
29 void set_bits(unsigned char sn)
31 LATCbits.LATC0 = ((mask >> sn) & 1) ^ ~0x1;
34 volatile unsigned char bit;
36 void testBug(void)
38 LATCbits.LATC0 = 1;
39 mask = 0x00;
40 bit = 0;
41 set_bits(bit);
42 ASSERT(!LATCbits.LATC0);