http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807

             Bug #: 50807
           Summary: [avr]
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: g...@gcc.gnu.org
                CC: eric.wedding...@atmel.com
            Target: avr


The following line of code

const char __attribute__((progmem)) var = "Hallo"[0];

compileds with

avr-g++ progmem.c -S -Os

compiles code that tries to initialize var at run time:

    .section    .text.startup,"ax",@progbits
    .type    _GLOBAL__sub_I_progmem.c, @function
_GLOBAL__sub_I_progmem.c:
    ldi r24,lo8(72)
    sts _ZL3var,r24
    ret
    .size    _GLOBAL__sub_I_progmem.c, .-_GLOBAL__sub_I_progmem.c

    .global __do_global_ctors
    .section .ctors,"a",@progbits
    .word    gs(_GLOBAL__sub_I_progmem.c)
    .local    _ZL3var
    .comm    _ZL3var,1,1

As var is located in flash and thus cannot be initialized at runtime, there
should be an error message like
"progmem variable var cannot be initialized at load time".

Reply via email to