1. For sample code, please see the 'sample.c' attachment.
2. Exact command used to run SDCC on the sample code:
Tried both 'sdcc -mmcs51 sample.c' and 'sdcc -mmcs51 --model-medium sample.c'. With the former command, the code works as expected. With the --model-medium option however, the code does not work as expected.
3. SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.2 #5492 (Aug 17 2009) (MINGW32)
4. Depending on the options specified, sometimes some code is not executed. Please see the 'sample.c' attachment for more information.