public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23628] New: Typeinfo comparison code easily breaks shared libs
@ 2005-08-29 19:55 mmarcus at emarcus dot org
  2005-08-29 19:58 ` [Bug c++/23628] " pinskia at gcc dot gnu dot org
                   ` (24 more replies)
  0 siblings, 25 replies; 27+ messages in thread
From: mmarcus at emarcus dot org @ 2005-08-29 19:55 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2005-09-01 10:42 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-29 19:55 [Bug c++/23628] New: Typeinfo comparison code easily breaks shared libs mmarcus at emarcus dot org
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

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