#291 sdcc optimizer miscompiles certain code

closed-fixed
5
2013-05-25
2002-02-07
Anonymous
No

We have run into problems where the code optimizer
generates wrong assembler code under certain conditions.

Here is a piece of sample code which triggers the problem:

unsigned char Instruction_einlesen(unsigned data char
*ins) {
unsigned data char rw=0;
unsigned data char c=0;
unsigned data char i=0;
unsigned data char *ins1=ins;
for(c=0;c<=7;c++) {
i=serial_getc();
ins1[c]=i;
}
ins[8]=0;

The optimizer rearranges the for loop to count from 8
down to 1. Therefore ins1 is written in reverse order.
I send the resulting assemble code as attachment, which
shows the effect in detail.

We have used win32 binaries, versions 2.3.1-pj1 and the
snapshot from February 7, both show the same effect.

sdcc 2.2.1 on linux does NOT exhibit this wrong
behaviour, i.e. it compiles the same code sequence
correctly.

Discussion

  • Johan Knol

    Johan Knol - 2002-02-08
    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed
     
  • Johan Knol

    Johan Knol - 2002-02-08

    Logged In: YES
    user_id=63512

    fixed in SDCCast.c:1.140

     

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

Sign up for the SourceForge newsletter:





No, thanks