public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mmarcus at emarcus dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/23628] New: Typeinfo comparison code easily breaks shared libs
Date: Mon, 29 Aug 2005 19:55:00 -0000	[thread overview]
Message-ID: <20050829194742.23628.mmarcus@emarcus.org> (raw)

There is a problem in GCC's typeinfo comparison code where it just compares the
address of the symbol, not what the symbol points at. Hence if the linker
chooses one typeinfo instance in one binary and another in another binary, even
though they are the same typeinfo it returns different results.

This means you must be very, very careful to ensure the typeinfos for the
symbols which get compared must be default visibility in ALL compilation units
if and ONLY if the RTTI "lives" in different shared libraries. As you might
guess, this can get tricky to get right!

We were fortunate that in one of the boost::signals test executables, this leads
to a repeatable crash (boost_any_bridge fails to detect that two types are the
same, because of an erroneous type info comparison). It is much worse in some
other situations. I have seen silent failures (such as the "type" of a standard
exception being changed between where it is thrown and where it is caught). The
problem was obscured by a time by the fact that, despite claims to the contrary
in the documentation, it seems that the symbols are not being made visible in
the "hosting" executable by default. As a result we have two separate copies of
the typeinfo.

-- 
           Summary: Typeinfo comparison code easily breaks shared libs
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mmarcus at emarcus dot org
                CC: gcc-bugs at gcc dot gnu dot org,gdr at integrable-
                    solutions dot net


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


             reply	other threads:[~2005-08-29 19:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-29 19:55 mmarcus at emarcus dot org [this message]
2005-08-29 19:58 ` [Bug c++/23628] " pinskia at gcc dot gnu dot org
2005-08-29 19:59 ` pinskia at gcc dot gnu dot org
2005-08-29 20:23 ` mmarcus at emarcus dot org
2005-08-29 20:27 ` mmarcus at emarcus dot org
2005-08-29 20:30 ` pinskia at gcc dot gnu dot org
2005-08-29 20:31 ` pinskia at gcc dot gnu dot org
2005-08-29 20:34 ` pinskia at gcc dot gnu dot org
2005-08-29 20:40 ` pinskia at gcc dot gnu dot org
2005-08-29 20:49 ` mmarcus at emarcus dot org
2005-08-29 20:56 ` pinskia at gcc dot gnu dot org
2005-08-29 20:57 ` pinskia at gcc dot gnu dot org
2005-08-29 21:01 ` mmarcus at emarcus dot org
2005-08-29 21:05 ` mmarcus at emarcus dot org
2005-08-29 21:11 ` pinskia at gcc dot gnu dot org
2005-08-29 21:32 ` mmarcus at emarcus dot org
2005-08-29 21:32   ` Andrew Pinski
2005-08-29 21:57 ` pinskia at physics dot uc dot edu
2005-08-29 22:14 ` mmarcus at emarcus dot org
2005-08-30 13:17 ` ghost at cs dot msu dot su
2005-08-30 13:44 ` gdr at integrable-solutions dot net
2005-08-31  7:19 ` ghost at cs dot msu dot su
2005-08-31 14:21 ` pinskia at gcc dot gnu dot org
2005-08-31 14:39 ` ghost at cs dot msu dot su
2005-08-31 14:56 ` gdr at integrable-solutions dot net
2005-09-01  8:35 ` mmarcus at emarcus dot org
2005-09-01 10:42 ` s_gccbugzilla at nedprod dot com

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=20050829194742.23628.mmarcus@emarcus.org \
    --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).