From: SourceForge.net <no...@so...> - 2003-09-06 17:46:26
|
Bugs item #800998, was opened at 2003-09-05 05:50 Message generated for change (Comment added) made by epetrich You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=800998&group_id=599 Category: z80 port >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Akiya ISHIDA (akiya-i) >Assigned to: Erik Petrich (epetrich) Summary: Write result back to BROKEN HL address Initial Comment: I found Z80 code generator bug on SDCC : mcs51/gbz80/z80/avr/ds390/pic14/pic16/TININative/xa51 /ds400 2.3.5 (Aug 18 2003) (UNIX) I attach two files, source and asm, asm file was generated by the compiler with the command... % sdcc -c -mz80 -I../include bug.c Brief overview of the problem: The C statement { global_struct.char_member --; } compiled into following Z80 code. ld hl, #{ADDR of struct} ; load HL pointer to struct. ld l,(hl) ; load char_member to L. ; HL pair was BROKEN. ld a,l add a,#0xFF ; doing -- ld c,a ; c = char_member -1; ld (hl),c ; <<<< Write C to address of BROKEN HL pair !! The code write back result to WRONG address of BROKEN HL pair. I looked into z80/gen.c, but couldn't figure out how to fix. Hoping this helps somenoe.... ---------------------------------------------------------------------- >Comment By: Erik Petrich (epetrich) Date: 2003-09-06 12:46 Message: Logged In: YES user_id=635249 Fixed in src/z80/gen.c 1.117 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=800998&group_id=599 |