This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53493] [4.7 regression] Compiling with -Os excludes PROGMEM array from generated object file (__attribute__((__progmem__)))
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 26 May 2012 19:26:27 +0000
- Subject: [Bug c++/53493] [4.7 regression] Compiling with -Os excludes PROGMEM array from generated object file (__attribute__((__progmem__)))
- Auto-submitted: auto-generated
- References: <bug-53493-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53493
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-26 19:26:27 UTC ---
> I'm pretty sure that the C++ standard does not specify that separate
> compilation should break unless all const variables are used in the compilation
> unit where they are defined.
It defines them if they have const keyword, they have to be defined in each
translational unit. If not then the one where it is declared has to be marked
extern.
Something like:
extern unsigned char const foo[4];
unsigned char const foo[4] = { 'f', 'o', 'o', 0 };
---- CUT ----
is required and that turns the linkage to be external. Otherwise foo has vague
linkage (a C++ term saying it has to be the same in each translational unit
that it is used).