From: Johan K. <joh...@id...> - 2001-10-31 16:38:00
|
Fixed in SDCCloop.c:1.19 This looked like bug #476683, but was completely different. This fix, as well as the one from bug #221220 could be improved, so I left a 'TODO' tag that will remember me (or someone else) at some time. ----- Original Message ----- From: <no...@so...> To: <no...@so...> Sent: Wednesday, October 31, 2001 8:40 AM Subject: [sdcc-devel] [ sdcc-Bugs-476678 ] Global scoping is getting lost > Bugs item #476678, was opened at 2001-10-30 23:40 > You can respond by visiting: > http://sourceforge.net/tracker/?func=detail&atid=100599&aid=476678&group_id= 599 > > Category: Icode generator > Group: None > Status: Open > Resolution: None > Priority: 5 > Submitted By: Scott Dattalo (sdattalo) > Assigned to: Nobody/Anonymous (nobody) > Summary: Global scoping is getting lost > > Initial Comment: > > unsigned char char0 = 0; > unsigned char char1 = 0; > unsigned char char2 = 0; > unsigned char i = 0; > > > void c2(void) > { > > char2 = char0+1; > } > > void c1(void) > { > char2 = 9; > > for(i=0;i<4;i++) { > c2(); > char1=char2; > char0+=char1; > > } > } > > --------- > The scope of char2 is getting lost in the assignment > char1=char2; statement. > > e.g.: > sdcc -c -mmcs51 t.c > > <snip> > ; t.c 28 > ; ----------------------------------------- > ; function c1 > ; ----------------------------------------- > _c1: > ; t.c 30 > mov _char2,#0x09 > ; t.c 32 > mov _i,#0x00 > mov r2,#0x09 > 00101$: > clr c > mov a,_i > subb a,#0x04 > ; Peephole 108 removed ljmp by inverse jump logic > jnc 00105$ > 00109$: > ; t.c 33 > push ar2 > lcall _c2 > pop ar2 > ; t.c 34 > mov _char1,r2 > ; t.c 35 > mov a,_char1 > add a,_char0 > mov _char0,a > ; t.c 32 > inc _i > ; Peephole 132 changed ljmp to sjmp > sjmp 00101$ > 00105$: > ret > > <snip> > At t.c 34, the assignment of char1=char2 is actually > being generated as char1=r2, which is scoped locally to > c1(). I'm fairly certain that it's an iCode problem > because I saw this first in the PIC Port. > > Scott > > > ---------------------------------------------------------------------- > > You can respond by visiting: > http://sourceforge.net/tracker/?func=detail&atid=100599&aid=476678&group_id= 599 > > _______________________________________________ > sdcc-devel mailing list > sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-devel > |