This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16018] New: dynamic_cast fail accross shared libraries
- From: "amos at ilogix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jun 2004 12:01:45 -0000
- Subject: [Bug c++/16018] New: dynamic_cast fail accross shared libraries
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
dynamic_cast<> sometimes fail when declaring a class in one shared library,
allocating an object (Base*in another shared library, passing a pointer of a
base to the third shared library and using dynamic_cast to down cast.
Note (1): the base and the derived are defined in different shared libraries.
Note (2): the shared libraries are statically linked (e.g. loaded at the
application initialization).
This is a critical issue since it breaks the ability to use RTTI in large
applications.
-------------------
Illustration
-------------------
[libx1.so]
class B
{
...
};
[libx2.so]
class D : public B
{
...
};
[libx3.so]
B* b = new D;
[libx4.so]
D* d = dynamic_cast<D*>(b);
assert(d != 0); // FAIL
--
Summary: dynamic_cast fail accross shared libraries
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amos at ilogix dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
GCC host triplet: Red Hat Linux 8.0
GCC target triplet: Red Hat Linux 8.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16018