avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Optimization bug in AVRGCC 3.3 compiler


From: Alexei Semenov
Subject: [avr-gcc-list] Optimization bug in AVRGCC 3.3 compiler
Date: Fri, 4 Apr 2003 22:25:44 +0400

Following C code produces inapplicable assembler code with
WinAVR-20030312:

#include <avr/io.h>

int main(void)
{
   unsigned char v= 0;
   for(;;)
   {
      if ((PIND ^ v) & 1) // do wrong compiling
      {
          v= ~v;
          PORTB= v;
      }
   }
}

Compiling with:
        avr-gcc -S -Os -mmcu=at90s2313 Tst.c

produces Tst.s:

         ...
main:
/* prologue: frame size=0 */
        ldi r28,lo8(__stack - 0)
        ldi r29,hi8(__stack - 0)
        out __SP_H__,r29
        out __SP_L__,r28
/* prologue end (size=4) */
.L6:
        in r24,48-0x20
        rjmp .L6
        ...

Compiling without optimization produces correct assembler code.
        
-- 
Best regards,
 Alexei                          mailto: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]