From: SourceForge.net <no...@so...> - 2004-11-14 11:58:08
|
Bugs item #1065458, was opened at 2004-11-12 22:42 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1065458&group_id=599 >Category: msc51(8051) target >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Stas Sergeev (stsp) >Assigned to: Maarten Brock (maartenbrock) Summary: mishandling of "short" return value Initial Comment: Hi. This bug was recently introduced in CVS. The following code (attached): --- unsigned short f() { return 0xff00; } unsigned short main() { return f() ? 1 : 0; } --- returns 0 instead of 1. The asm code at fault is this: --- lcall _f mov a,dpl ; genIfx ; Peephole 105 removed redundant mov ; Peephole 177.c removed redundant move mov b,a <---- BUG orl a,b --- ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2004-11-14 12:58 Message: Logged In: YES user_id=888171 Fixed in SDCC 2.4.6 #880 ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-11-13 14:10 Message: Logged In: YES user_id=888171 What it should fix is the condition that aopGet() might use A and thereby destroy what used to be in there. But somehow in this case DPH:DPL gets moved into B:A but _G.BInUse is not set. Trying to find a solution. with --no-peep: lcall _f mov a,dpl mov b,dph ; genIfx mov b,a mov a,b orl a,b ---------------------------------------------------------------------- Comment By: Erik Petrich (epetrich) Date: 2004-11-13 07:57 Message: Logged In: YES user_id=635249 This is a problem with toBoolean() in src/mcs51/gen.c 1.210 Maarten, what condition was this revision supposed to fix/optimize? Unless I am overlooking something, I think this function needs to revert to its 1.209 state. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1065458&group_id=599 |