Bugs item #805445, was opened at 2003-09-12 20:13
Message generated for change (Comment added) made by epetrich
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=805445&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: Z80: bitwise XOR write back bug
Initial Comment:
"int ^= int;" is compiled into wrong code.
Sample code doing "a^=b;", this line was compiled into
ld a,6(ix) ; load low byte of b
xor a,4(ix) ; xor with low byte of a
ld 4(ix),a ; write back to low byte of
axor lowbyte
ld a,7(ix) ; load high byte of b
xor a,5(ix) ; xor with high byte of a
ld 4(ix),a ; write high byte back to not
HIGH but LOW BYTE of a!!
; '4(ix)' should be '5(ix)'
source: (xor.c)
int *xor(int a,int b)
{
a ^= b;
return &a;
}
sdcc version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic14/pic16/TININative/xa51
/ds400 2.3.5 (Aug 18 2003) (UNIX)
compile option:
sdcc -mz80 -c xor.c
----------------------------------------------------------------------
>Comment By: Erik Petrich (epetrich)
Date: 2003-09-12 21:16
Message:
Logged In: YES
user_id=635249
Fixed in src/z80/gen.c 1.118
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=805445&group_id=599
|