public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53493] New: [4.7 regression] Compiling with -Os excludes PROGMEM array from generated object file (__attribute__((__progmem__)))
@ 2012-05-26  1:50 jwatte at gmail dot com
  2012-05-26 17:25 ` [Bug c++/53493] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jwatte at gmail dot com @ 2012-05-26  1:50 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53493
           Summary: [4.7 regression] Compiling with -Os excludes PROGMEM
                    array from generated object file
                    (__attribute__((__progmem__)))
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jwatte@gmail.com


I'm using AVR-GCC 4.7.0-1 from Arch Linux, if it matters. 

When compiling with -Os (which is pretty much a must for most source code,) an
exported data array declared as PROGMEM will be removed by the compiler! 

Compare without -Os: 

Code:
$ avr-gcc -mmcu=atmega328p -c foo.cpp -o foo.o && avr-objdump -s foo.o 

foo.o:     file format elf32-avr 

Contents of section .progmem.data: 
 0000 666f6f00                             foo.            
Contents of section .comment: 
 0000 00474343 3a202847 4e552920 342e372e  .GCC: (GNU) 4.7. 
 0010 3000                                 0.              


to with -Os: 

Code:
$ avr-gcc -Os -mmcu=atmega328p -c foo.cpp -o foo.o && avr-objdump -s foo.o 

foo.o:     file format elf32-avr 

Contents of section .comment: 
 0000 00474343 3a202847 4e552920 342e372e  .GCC: (GNU) 4.7. 
 0010 3000                                 0.              


Here is foo.cpp: 

Code:
#include <avr/pgmspace.h> 

unsigned char const foo[4] PROGMEM = { 'f', 'o', 'o', 0 }; 



Must I add some magic GNU make hack to my makefiles to not pass -Os for these
files? That's fairly cumbersome  
Is this a known bug? Is there a patch?


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-26 20:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-26  1:50 [Bug c++/53493] New: [4.7 regression] Compiling with -Os excludes PROGMEM array from generated object file (__attribute__((__progmem__))) jwatte at gmail dot com
2012-05-26 17:25 ` [Bug c++/53493] " pinskia at gcc dot gnu.org
2012-05-26 19:26 ` jwatte at gmail dot com
2012-05-26 19:26 ` jwatte at gmail dot com
2012-05-26 19:40 ` pinskia at gcc dot gnu.org
2012-05-26 20:30 ` jwatte at gmail dot com
2012-05-26 20:31 ` pinskia 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).