struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2826.c
blob9d243e5940e78c14f22c6a10140213f2bc79961b
1 /*
2 bug-2826.c
3 An optimization inserted instructions in between IPUSH and CALL which resulted in wrong code for mcs51.
4 */
6 #include <testfwk.h>
8 #define DS_CMD_RAM 1 << 6
10 unsigned char cfg_table[4];
12 unsigned char f(unsigned char j)
14 static unsigned char testval = DS_CMD_RAM >> 1 | 2;
15 ASSERT(j == testval);
16 testval++;
17 return(0);
20 void testBug(void)
22 unsigned char i, j;
23 j = DS_CMD_RAM >> 1 | 2;
24 for (i = 0; i != 4; i++)
25 cfg_table[i] = f(j++); // The incremented value got passed to f for mcs51.