public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50807] New: [avr]
@ 2011-10-20 10:13 gjl at gcc dot gnu.org
2011-10-20 10:17 ` [Bug target/50807] [avr] gjl at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-20 10:13 UTC (permalink / raw)
To: gcc-bugs
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr]
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
@ 2011-10-20 10:17 ` gjl at gcc dot gnu.org
2011-10-26 18:00 ` [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-20 10:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P5
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-10-20
Target Milestone|--- |4.6.2
Ever Confirmed|0 |1
Known to fail| |4.6.2, 4.7.0
Severity|normal |minor
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-20 10:16:37 UTC ---
Confirmed with 4.6.2
The generated code is a bit different.
var is put into the correct section .progmem but there is no error and the
constructor will write to RAM:
.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)
.section .progmem.data,"a",@progbits
.type _ZL3var, @object
.size _ZL3var, 1
_ZL3var:
.skip 1,0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
2011-10-20 10:17 ` [Bug target/50807] [avr] gjl at gcc dot gnu.org
@ 2011-10-26 18:00 ` jakub at gcc dot gnu.org
2012-03-01 15:26 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-10-26 18:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.6.2 |4.6.3
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-26 17:13:59 UTC ---
GCC 4.6.2 is being released.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
2011-10-20 10:17 ` [Bug target/50807] [avr] gjl at gcc dot gnu.org
2011-10-26 18:00 ` [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash jakub at gcc dot gnu.org
@ 2012-03-01 15:26 ` jakub at gcc dot gnu.org
2013-04-12 16:16 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-01 15:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.6.3 |4.6.4
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-01 14:39:18 UTC ---
GCC 4.6.3 is being released.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
` (2 preceding siblings ...)
2012-03-01 15:26 ` jakub at gcc dot gnu.org
@ 2013-04-12 16:16 ` jakub at gcc dot gnu.org
2013-06-11 11:43 ` gjl at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-12 16:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-12 16:16:16 UTC ---
Is this reproduceable with 4.7.3, 4.8.0 or the trunk?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
` (3 preceding siblings ...)
2013-04-12 16:16 ` jakub at gcc dot gnu.org
@ 2013-06-11 11:43 ` gjl at gcc dot gnu.org
2013-11-10 8:10 ` pinskia at gcc dot gnu.org
2014-09-21 14:36 ` gjl at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-06-11 11:43 UTC (permalink / raw)
To: gcc-bugs
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];
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
` (4 preceding siblings ...)
2013-06-11 11:43 ` gjl at gcc dot gnu.org
@ 2013-11-10 8:10 ` pinskia at gcc dot gnu.org
2014-09-21 14:36 ` gjl at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-10 8:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |target
Target Milestone|4.6.4 |---
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
` (5 preceding siblings ...)
2013-11-10 8:10 ` pinskia at gcc dot gnu.org
@ 2014-09-21 14:36 ` gjl at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: gjl at gcc dot gnu.org @ 2014-09-21 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50807
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to work| |4.9.2
Resolution|--- |WORKSFORME
Target Milestone|--- |4.9.0
--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Works in 4.9.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-21 14:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-20 10:13 [Bug target/50807] New: [avr] gjl at gcc dot gnu.org
2011-10-20 10:17 ` [Bug target/50807] [avr] gjl at gcc dot gnu.org
2011-10-26 18:00 ` [Bug target/50807] [avr] Constructor writing to RAM for variable in Flash jakub at gcc dot gnu.org
2012-03-01 15:26 ` jakub at gcc dot gnu.org
2013-04-12 16:16 ` jakub at gcc dot gnu.org
2013-06-11 11:43 ` gjl at gcc dot gnu.org
2013-11-10 8:10 ` pinskia at gcc dot gnu.org
2014-09-21 14:36 ` gjl at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).