[Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 11 11:43:00 GMT 2013
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];
More information about the Gcc-bugs
mailing list