From: SourceForge.net <no...@so...> - 2007-07-06 21:12:50
|
Bugs item #1738367, was opened at 2007-06-16 07:33 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1738367&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Maarten Brock (maartenbrock) Assigned to: Maarten Brock (maartenbrock) Summary: bit returned in dpl Initial Comment: The following code still generates code that returns a bit in dpl for the mcs51. bit Ternary(unsigned char status) { return (status == 0) ? 0 : 1; } _Ternary: ar2 = 0x02 ar3 = 0x03 ar4 = 0x04 ar5 = 0x05 ar6 = 0x06 ar7 = 0x07 ar0 = 0x00 ar1 = 0x01 ; genReceive ; heaters.c:6: return (status == 0) ? 0 : 1; ; genNot ; peephole 177.g optimized mov sequence mov a,dpl mov r2,a cjne a,#0x01,00105$ 00105$: clr a rlc a ; genNot mov r2,a ; Peephole 105 removed redundant mov cjne a,#0x01,00106$ 00106$: clr a rlc a mov dpl,a ; genRet ; Peephole 500 removed redundant label 00101$ ret Not to mention the unoptimized code. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2007-07-06 14:12 Message: Logged In: NO i've proposed a patch in the bug track [ 1745717 ] bit returned in dpl #2 it seems that patch works around this bug "[ 1738367 ] bit returned in dpl" as well said patch will pass the regression test file from frief bug1738367.c (which is by the way longer and more extensive than another allready contained and unfortunatly identically named test file) greetings, Robert Larice larice 0x40 vidisys 0x2e de ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2007-06-28 04:03 Message: Logged In: NO SDCC : mcs51 2.7.2 # (Jun 28 2007) (UNIX) svn #4870 still produces incorrect code, for the slightly modified function bit foo(char arg) { return arg & 1; } ==> 0000 E5 82 108 mov a,dpl 0002 54 01 109 anl a,#0x01 0004 F5 82 110 mov dpl,a 0006 22 111 ret thus, the function still returns a char in dpl, instead of a bit in the carry flag greetings, Robert Larice larice 0x40 vidisys 0x2e de ---------------------------------------------------------------------- Comment By: Frieder Ferlemann (frief) Date: 2007-06-20 05:04 Message: Logged In: YES user_id=589052 Originator: NO I'm attaching a file which allows to reproduce the bug within the regression test suite. Note, older versions of SDCC (I tested with SDCC 2.7.1 #4827) pass the test whereas uptodate versions do not. Greetings, Frieder File Added: bug1738367.c ---------------------------------------------------------------------- Comment By: Frieder Ferlemann (frief) Date: 2007-06-17 01:32 Message: Logged In: YES user_id=589052 Originator: NO These would fail too: return (status == 0) ? 1 : 0; return !status ? 1 : 0; return status ? 0 : 1; ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2007-06-16 14:20 Message: Logged In: YES user_id=888171 Originator: YES Seems it was not fixed at all. The following still fails: return (status == 0) ? (bit)0 : (bit)1; ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2007-06-16 07:53 Message: Logged In: YES user_id=888171 Originator: YES Fixed in SDCC 2.7.2 #4854. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1738367&group_id=599 |