This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/16672] New: Weak attribute propagates from declaration to definition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]