This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16672] New: Weak attribute propagates from declaration to definition
- From: "algrant at myrealbox dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2004 15:40:25 -0000
- Subject: [Bug c/16672] New: Weak attribute propagates from declaration to definition
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This
__attribute__((weak)) int f(int);
int f(int n) { return n + 1; }
exports f weakly (on e.g. ELF targets), despite the definition
not being marked weak. This is dangerous (producing weak exports
unintendedly can hide symbol clashes) and unhelpful (because it
removes the ability to produce a non-weak definition in the
presence of a weak declaration e.g. in a library header).
It would be better, and more intuitively consistent with linkage
semantics, if a non-weak definition superseded a weak declaration.
This would not be a dangerous quiet change; at worst it will cause
link-time errors due to multiple new non-weak definitions, for
which the solution is to work out which definitions really are
weak and annotate them explicitly.
--
Summary: Weak attribute propagates from declaration to definition
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: algrant at myrealbox dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16672