This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/50807] New: [avr]


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: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]