public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joerg dot richter at pdv-fs dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/21264] New: duplicate symbol warnings for complex template class
Date: Thu, 28 Apr 2005 12:08:00 -0000	[thread overview]
Message-ID: <20050428120749.21264.joerg.richter@pdv-fs.de> (raw)

/// template.cc /////////////////////////////////////////
struct VirtualBase
{
    virtual ~VirtualBase();
};

struct Foo
{};

struct Bar
{
    virtual ~Bar();
};

template<class OtherBase>
class Test : public VirtualBase, public OtherBase
{
};

void func()
{
  Test<Foo> foo;
  Test<Bar> bar;
}

//////////////////////////////////////////

$ /tools/pkg/gcc/3.4.3/bin/g++ -shared -Wl,-G -o lib343.so template.cc
$ dump -Tv lib343.so | c++filt

IMEX Sclass   Type           IMPid Name
 EXP     DS   Ldef        [noIMid] Test<Bar>::~Test()
 EXP     DS   Ldef        [noIMid] Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] non-virtual thunk to Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] non-virtual thunk to Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] Test<Foo>::~Test()
wEXP     DS SECdef        [noIMid] Test<Foo>::~Test()


$ /tools/pkg/gcc/3.3.3/bin/g++ -shared -Wl,-G -o lib333.so template.cc
$ dump -Tv lib333.so | c++filt

IMEX Sclass   Type           IMPid Name
wEXP     DS SECdef        [noIMid] Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] non-virtual thunk to Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] non-virtual thunk to Test<Bar>::~Test()
wEXP     DS SECdef        [noIMid] Test<Foo>::~Test()
wEXP     DS SECdef        [noIMid] Test<Foo>::~Test()

Note that I edited the dump output to reduce its size.

Here you can see, that the Test<...>::~Test() destructor gets a different IMEX. 
Depending on its template parameter and/or compiler version.

I dont know exactly what the difference between EXP and wEXP is, but I suspect 
that this has something to do with weak symbols. But on the other hand, I 
always read that AIX supports no weak symbols.

Nevertheless, when using the class Test<Bar> in different shared libraries 
which get linked together, you get warnings about duplicate symbols. This 
warnings were not present with GCC 3.3.3.

I am very nervous when seeing duplicate symbols. Especially on AIX. I had great 
times in the past analysing problems with uncaught exceptions that were caused 
by duplicate symbols.

-- 
           Summary: duplicate symbol warnings for complex template class
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.2.0.0
  GCC host triplet: powerpc-ibm-aix5.2.0.0
GCC target triplet: powerpc-ibm-aix5.2.0.0


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


             reply	other threads:[~2005-04-28 12:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 12:08 joerg dot richter at pdv-fs dot de [this message]
2005-05-03 19:10 ` [Bug c++/21264] " dje at gcc dot gnu dot org
2005-05-17 14:51 ` aph at gcc dot gnu dot org
2005-05-31 17:28 ` pinskia at gcc dot gnu dot org

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=20050428120749.21264.joerg.richter@pdv-fs.de \
    --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).