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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> Is this reproduceable with 4.7.3, 4.8.0 or the trunk?

With the test case from above and 4.8.0, no code is generated at all.

With an extended test case as follows, the constructor still writes to RAM in
insn 6:

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

const char *foo (void)
{
    return &var;
}

_GLOBAL__sub_I__Z3foov:
    ldi r24,lo8(72)     ;  5    movqi_insn/2    [length = 1]
    sts _ZL3var,r24     ;  6    movqi_insn/3    [length = 2]
    ret     ;  13    return    [length = 1]

And there is a warning from the back end:

foo.c: In function 'const char* foo()':
foo.c:1:37: warning: uninitialized variable 'var' put into program memory area
[-Wuninitialized]
 const char __attribute__((progmem)) var = "Hallo"[0];

Reply via email to