Bug#134262: g++-3.0: Use of dynamic_cast makes compiled program segfault
Package: g++-3.0
Version: 1:3.0.4-0pre020210
Severity: important
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux abyss 2.4.16 #1 Tue Nov 27 04:00:11 CET 2001 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages g++-3.0 depends on:
ii gcc-3.0 1:3.0.4-0pre020210 The GNU C compiler.
ii gcc-3.0-base 1:3.0.4-0pre020210 The GNU Compiler Collection (base
ii libc6 2.2.5-3 GNU C Library: Shared libraries an
ii libstdc++3-dev 1:3.0.4-0pre020210 The GNU stdc++ library version 3 (
Example:
Breakpoint 2, osgDB::ReaderWriter::ReadResult::getNode() (this=0xbffff2a0)
at /home/source/osg/cvs/include/osgDB/ReaderWriter:64
64 osg::Node* getNode() { return dynamic_cast<osg::Node*>(_object.get()); }
(gdb) print _object
$3 = {_ptr = 0x808f170}
(gdb) print &_object
$4 = (ref_ptr<osg::Object> *) 0xbffff2a8
(gdb) bt
#0 osgDB::ReaderWriter::ReadResult::getNode() (this=0xbffff2a0)
at /home/source/osg/cvs/include/osgDB/ReaderWriter:64
#1 0x400a9981 in osgDB::ReaderWriter::ReadResult::validNode() (
this=0xbffff2a0) at /home/source/osg/cvs/include/osgDB/ReaderWriter:68
#2 0x4009f2ce in osgDB::Registry::readNode(std::string const&) (
this=0x808dde8, fileName=@0xbffff674) at Registry.cpp:838
#3 0x40098c2a in osgDB::readNodeFile(std::string const&) (
filename=@0xbffff674) at ReadFile.cpp:33
#4 0x08052f8a in main (argc=1, argv=0xbffff7e4) at test.cpp:111
#5 0x405e36cf in __libc_start_main () from /lib/libc.so.6
(gdb) s
osg::ref_ptr<osg::Object>::get() (this=0xbffff2a8)
at /home/source/osg/cvs/include/osg/ref_ptr:94
94 inline T* get() { return _ptr; }
(gdb) print _ptr
$5 = (Object *) 0x808f170
(gdb) bt
#0 osg::ref_ptr<osg::Object>::get() (this=0xbffff2a8)
at /home/source/osg/cvs/include/osg/ref_ptr:94
#1 0x400a9c59 in osgDB::ReaderWriter::ReadResult::getNode() (this=0xbffff2a0)
at /home/source/osg/cvs/include/osgDB/ReaderWriter:64
#2 0x400a9981 in osgDB::ReaderWriter::ReadResult::validNode() (
this=0xbffff2a0) at /home/source/osg/cvs/include/osgDB/ReaderWriter:68
#3 0x4009f2ce in osgDB::Registry::readNode(std::string const&) (
this=0x808dde8, fileName=@0xbffff674) at Registry.cpp:838
#4 0x40098c2a in osgDB::readNodeFile(std::string const&) (
filename=@0xbffff674) at ReadFile.cpp:33
#5 0x08052f8a in main (argc=1, argv=0xbffff7e4) at test.cpp:111
#6 0x405e36cf in __libc_start_main () from /lib/libc.so.6
(gdb) s
0x400a9c59 in osgDB::ReaderWriter::ReadResult::getNode() (this=0xbffff2a0)
at /home/source/osg/cvs/include/osgDB/ReaderWriter:64
64 osg::Node* getNode() { return dynamic_cast<osg::Node*>(_object.get()); }
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
0x0808f170 in ?? ()
(gdb)
/Daniel
Reply to: