- milestone: --> fixed
- assigned_to: nobody --> bernhardheld
- status: open --> closed-fixed
When the first character of a string literal is \x00 the
rest of the string is not used for initialisation.
Code:
code char* code ch="\x00\x12\x34\x56";
void main(void) {}
Compiled result:
_main:
ar2 = 0x02
ar3 = 0x03
ar4 = 0x04
ar5 = 0x05
ar6 = 0x06
ar7 = 0x07
ar0 = 0x00
ar1 = 0x01
00101$:
ret
.area CSEG (CODE)
_ch:
.byte _str_0,(_str_0 >> 8)
_str_0:
;storage space correctly allocated
;string init data is missing!!!
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.area XINIT (CODE)
On the other hand the code compiles correctly when the
first character is nonzero:
code char* code ch="\x01\x12\x34\x56";
void main(void) {}
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51
/ds400/hc08 2.4.2 (Jun 13 2004) (MINGW32)
Email: bortel.laszlo@ln.matav.hu