This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/20321] New: keep static constants if named section attribute asserted
- From: "gary at intrepid dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Mar 2005 17:20:28 -0000
- Subject: [Bug c/20321] New: keep static constants if named section attribute asserted
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Related discussion:
http://gcc.gnu.org/ml/gcc/2005-03/msg00181.html
Related bug report: Bug #20319
I tried adding a section attribute to a static constant string declaration
which is otherwise not referenced, in the hope that the compiler would
retain the static constant because it had been explicitly
targeted to a named section,
static char const __attribute__ ((section("ident_sect"))) rcsid[] =
"$Id: f.c,v 5.4 1993/11/09 17:40:15 eggert Exp $";
int main() {}
but this didn't prevent the elimination of the const static defintion.
Enhancement request: If an explicit section attribute
is supplied for a static constant declaration (where the declaration
is not otherwise referenced), do not eliminate the static constant
definition. The rationale for this policy is that it is
reasonable to assume that if the user is explicitly assigning the
static constant to a named section, then he/she intends to use that
static constant defintion, and does not want it eliminated from the
executable image.
--
Summary: keep static constants if named section attribute
asserted
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gary at intrepid dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20321