public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "uddeborg at carmen dot se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/12401] New: G++ generates boguous weak definition of library routine
Date: Thu, 25 Sep 2003 12:29:00 -0000	[thread overview]
Message-ID: <20030925121817.12401.uddeborg@carmen.se> (raw)

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.


             reply	other threads:[~2003-09-25 12:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25 12:29 uddeborg at carmen dot se [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030925121817.12401.uddeborg@carmen.se \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).