From: SourceForge.net <no...@so...> - 2005-12-28 22:04:33
|
Bugs item #1365641, was opened at 2005-11-24 16:18 Message generated for change (Settings changed) made by bernhardheld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1365641&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: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: grasbon (grasbon) >Assigned to: Bernhard Held (bernhardheld) Summary: Assignments lost. Initial Comment: Assignments lost. ----------------- Version: SDCC: mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.5.4 #1168 (Nov 24 2005) (MINGW32) Call: "sdcc Main.c" In the following code, the assignments for 'i' in line 17 (i = 42) and line 24 (i = 24) of "main.c" are skipped. Hence the P1-assignment in line 27 becomes wrong. Here's the Main.c: ------------------------- #include <8052.h> void main(void) { unsigned char i; unsigned char u; static code char c = '?'; u = 0; while( 1 ) { i=0; switch( u ) { case 0: P1 = 0; i = 42; // Absent in "main.asm" break; case 1: while( c != 'x' && i < 9 ) i++; break; default: P1 = 2; i = 24; // Absent in "main.asm" } P1 = i; u++; } } ------------------------- Therefor have a look at Main.asm, line 380 ff: ------------ 00101$: ;Main.c:16: P1 = 0; ; genAssign mov _P1,#0x00 ;Main.c:18: break; --------- and line 416 ff: --------- 00107$: ;Main.c:23: P1 = 2; ; genAssign mov _P1,#0x02 ;Main.c:26: } --------- To turn off the peephole optimizer (--no-peep) has no effect. Reimar Grasbon ---------------------------------------------------------------------- Comment By: grasbon (grasbon) Date: 2005-11-25 08:50 Message: Logged In: YES user_id=1374486 Additional info: A workaround for that problem (in my projects) is to disable the loop induction by using the "--noinduction" option for compiling. Reimar ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1365641&group_id=599 |