#750 Problem with for-loops

closed-fixed
5
2013-05-25
2004-05-07
No

The following code example leads to bad assembler code
being generated:

///////// test.c
unsigned char screen[8][7];

void main() {
unsigned char i;
for (i = 1; i < 7; i++) {
screen[i][0]= 0xaa;
}
}
////////

compile with "sdcc --no-peep test.c"

I expect screen[1..6][0] to be filled with 0xaa.
Instead, however, screen[0..5][0] will be filled, while
screen[6][0] remains empty. (The index variable runs
from 5 down to 0.)
If the screen variable is one-dimensional, everything
work as expected.

I have tried this with the following sdcc version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.4.1 (May 7 2004) (UNIX)

I am using the following platform:
SunOS sun73 5.8 Generic_108528-23 sun4u sparc
SUNW,Sun-Blade-1000

Discussion

  • Erik Petrich

    Erik Petrich - 2004-05-19

    Logged In: YES
    user_id=635249

    Fixed in src/SDCCast.c 1.237

     
  • Erik Petrich

    Erik Petrich - 2004-05-19
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks