public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12401] New: G++ generates boguous weak definition of library routine
@ 2003-09-25 12:29 uddeborg at carmen dot se
  2003-09-25 14:37 ` [Bug c++/12401] " nathan at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: uddeborg at carmen dot se @ 2003-09-25 12:29 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: G++ generates boguous weak definition of library routine
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uddeborg at carmen dot se
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux

When compiling some code referencing library routines, the generated object file
 contains a "W" definition of this library routine.

1.Create a file c.cc containing
  #include <stdlib.h>

  int f()
  {
    return atoi <= 0;
  }
2. g++ -O -c c.cc
3. nm -gC c.o
    
This produces:
00000000 W atoi
         U __strtol_internal
00000000 T f()

I would expect an "U atoi" instead of the first two.

This occurs on Red Hat Enterprise Linux beta Taroon 2.  gcc-c++-3.2.3-19

Witout optimization, one gets the expected result.

One problem this behaviour cases occurs is the object file is placed in an
archive library.  If an application which links with this library uses, in this
case, atoi(), then this object file will be included in the end result.  Even if
there are no "real" references to it.  Which of course means any constructors of
global objects, or other side effects of its inclusion, will also happen.


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

end of thread, other threads:[~2004-01-15  7:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-25 12:29 [Bug c++/12401] New: G++ generates boguous weak definition of library routine uddeborg at carmen dot se
2003-09-25 14:37 ` [Bug c++/12401] " nathan at gcc dot gnu dot org
2003-12-25  3:27 ` pinskia at gcc dot gnu dot org
2003-12-25  4:16 ` pinskia at gcc dot gnu dot org
2003-12-25  4:40 ` pinskia at gcc dot gnu dot org
2003-12-25  4:49 ` pinskia at gcc dot gnu dot org
2004-01-14 16:57 ` uddeborg at carmen dot se
2004-01-14 17:36 ` pinskia at gcc dot gnu dot org
2004-01-15  7:52 ` uddeborg at carmen dot se

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).