From: Story, L. <Lenny.Story@Alcatel.com> - 2003-05-06 12:31:54
|
greetings, The problem you are seeing can happen if optimizers are turned on. Specifically the peep optimizer, as it changes the code at the last = possible moment before emitting the actuall instructions. The compiler can not = know that locations have changes, in fact the stack can have gaps because of = it.=20 You can set the Environment variable "SDCC_DEBUG_VAR_STORAGE" and it = will tell you which areas the variables are allocated too. Write back if you still have issues. -Lenny -----Original Message----- From: Martin Helmling [mailto:mh...@oc...] Sent: Tuesday, May 06, 2003 2:55 AM To: sdc...@li... Subject: [Sdcc-user] Bug in SDCC, ( mcs51 port ??) Hi, there is a bug in the sdcc compiler, to generate the correct allocated=20 register name to debug output and assembler : example.c: typedef unsigned char uchar; uchar usecount[8][2]; uchar cacheTxStatus( uchar n ) { return n + 5; } void cacheTxAnalogValue( uchar n, uchar m ) { } void _main (void) { uchar i,j,ok; for ( i=3D0 ; i < 8 ; i++ ) { ok =3D cacheTxStatus( i ); if ( ok ) { for ( j=3D0 ; j < 7 ; j++ ) cacheTxAnalogValue(i,j); ok =3D 5; } for ( j=3D0 ; j < 2; j++ ) { usecount[i][j] =3D ok; } } } output of example.asm: ;------------------------------------------------------------ ;Allocation info for local variables in function '_main' ;------------------------------------------------------------ ;i Allocated to registers ;j Allocated to registers ;ok Allocated to registers r3 ;------------------------------------------------------------ and example.adb: S:L_main$i$1$1({1}SC:U),R,0,0,[] S:L_main$j$1$1({1}SC:U),R,0,0,[] S:L_main$ok$1$1({1}SC:U),R,0,0,[r3] really in the code i is mapped to r2 and j is mapped to r4, so code is = ok. --=20 Thanks Martin Helmling +---------------------------------------------------- ! Octogon Software Development GmbH http://www.octo-soft.de ! ! Martin Helmling, Einsteinstra=DFe 11, D 68519 Viernheim ! ! ! Tel +49 6204/914874 ! FAX +49 6204/914875 email mh...@oc... ! D-Netz +49 172/8531004 mh...@gu... + ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Sdcc-user mailing list Sdc...@li... https://lists.sourceforge.net/lists/listinfo/sdcc-user |