dynamic_cast seg fault
Bernard Leach
leachbj@bouncycastle.org
Thu Sep 14 06:01:00 GMT 2000
Hi All,
I am have some C++ code that causes my program to
seg fault in a dynamic_cast statement. The problem
exists in the egcs-20000911 snapshot as well as the
release version. This is on sparc-sun-solaris2.7.
When I step into the dynamic_cast using gdb I see
__dynamic_cast_2 (from=0, to=0x2972a4 <ICeInput type_info function>,
boff=-1,
address=0x39e701, sub=0x2b3df0 <ICeRoot type_info function>,
subptr=0x39e6c8) at ./cp/tinfo2.cc:432
The from argument should not be 0 from what I can tell.
Yesterday I was looking at the assembler code leading
up to the __dynamic_cast call (this was using 2.95.2
not the snapshot) and it appeared that there were valid
addresses in the arguments but by the time the
__dynamic_cast call was made the from argument had
changed to 0...
Looking through GNATS there is mention of a dynamic_cast
bug (PR 349) but I was under the impression that the latest
snaptshot fixed it (although the test program listed
for that still does not product the expected output??)
The output with the snapshot is:
0x3fe00 0x3fe00 0x0
0x3fe00 0x3fe00 0x3fe00
0x3fe00 0x3fe00 0x3fe00
Another (possibly related) problem that I have is when
I do a dynamic_cast and then delete that object the program
crashes with an illegal instruction.
Any help would be muchly appreciated!
cheers,
bernard.
More information about the Gcc-bugs
mailing list