[Top][All Lists]

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

[avr-gcc-list] Perhaps a bug in atmega128 compiler or optimizer ?

From: Marc R. Wetzel
Subject: [avr-gcc-list] Perhaps a bug in atmega128 compiler or optimizer ?
Date: Fri, 3 May 2002 11:49:25 +0200


I got the following code from an user, that behaves differently
on mega103 and mega128 platform.

If you use just _LPM and not _ELPM it works on both platforms ( with -Os )
(but just for the lower 64kb )

If you use _ELPM and as compiler flag -Os you get
"inconsistent operand constraints in an `asm'" just on the _elpm_inline
line - in an mega128 build.

If you comment out the "vbyte = lbyte" line and using -Os it is compiled
but I think the optimizer throwed the "unused" code away.

The version you find at the end of this mail compiles fine if you use
the -O0 flag on both platforms,

Does anybody have a clue ?  I tried also the other x-different lpm  macros
with RAMPZ and (RAMPZ-0x20) patched in.


#include <io.h>
#include <pgmspace.h>

uint8_t __attribute__((progmem)) buf[] =
{ 0x7F, 0x45, 0x4C, 0x46 };

int main(void)
    unsigned long location;
    unsigned char lbyte;
    volatile unsigned char vbyte;

    location = (unsigned long) buf;

    lbyte = __elpm_inline(location);

    vbyte = lbyte;

    for (;;)

avr-gcc-list at http://avr1.org

reply via email to

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