struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2959.c
blobe57f5f0f5b36806e152c04d199f3dba4c4ef54fa
1 /*
2 bug-2959.c
4 The pdk backends tried to do a 16-bit read from an __sfr instead of an 8-bit read followed by a cast.
5 */
7 #include <testfwk.h>
9 // Test for all backends that can have an __sfr at 0x10.
10 #if (defined(__SDCC_pdk13) || defined(__SDCC_pdk14) || defined(__SDCC_pdk15) || defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_ez80_z80))
11 __sfr __at(0x10) _pa;
12 #elif defined(__SDCC_mcs51)
13 __sfr __at(0x99) _pa;
14 #else
15 unsigned char _pa;
16 #endif
18 void f(void)
20 if( 0x10 == (_pa & 0x10) ) // Code generation crash here.
22 __asm__("nop\n");
26 void testBug(void)