public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bangerth@dealii.org
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
	yanliu@ca.ibm.com
Subject: Re: c++/9433: [3.2/3.3/3.4 regression] SegFault in dynamic_cast
Date: Fri, 24 Jan 2003 15:22:00 -0000	[thread overview]
Message-ID: <20030124152242.25959.qmail@sources.redhat.com> (raw)

Old Synopsis: memory fault
New Synopsis: [3.2/3.3/3.4 regression] SegFault in dynamic_cast

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Jan 24 15:22:42 2003
State-Changed-Why:
    Confirmed (one x86 linux). It used to work with 2.95, but is broken in
    3.2, 3.3, and 3.4 branches/CVS. The following slightly
    simplified testcase shows the same behavior (the class
    hierarchy is an exercise in applied graph theory :-)
    -------------------------------
    struct A        { virtual ~A() {}; };
    struct B        {};
    struct C : A, B {};
    struct D : C    {};
    struct E : C    {};
    struct F : protected D, E {};
    struct H : virtual F {};
    struct I : H    {};
    struct J : H    {};
    struct K : I, J {};
    struct M : K    {};
    struct N : M    {};
    struct O : M    {};
    struct P : N, O {};
    
    int main() {
      P obj;
      A* a1 = (D*)&obj;
      dynamic_cast<H*>(a1);
    }
    -------------------------------
    The Segfault happens in the runtime support libs (with 3.4):
    
    (gdb) bt
    #0  0x4006c7a2 in __cxxabiv1::__vmi_class_type_info::__do_find_public_src(int, void const*, __cxxabiv1::__class_type_info const*, void const*) const (
        this=0x804a4a0, src2dst=-1, obj_ptr=0x0, src_type=0x804a488, 
        src_ptr=0xbffff184)
        at ../../../../gcc-3.4-CVS/libstdc++-v3/libsupc++/tinfo.cc:122
    #1  0x4006cd0d in __cxxabiv1::__vmi_class_type_info::__do_dyncast(int, __cxxabiv1::__class_type_info::__sub_kind, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info const*, void const*, __cxxabiv1::__class_type_info::__dyncast_result&) const (this=0x804ab60, src2dst=-1, 
        access_path=__contained_public, dst_type=0x804a4a0, obj_ptr=0xbffff174, 
        src_type=0x804a488, src_ptr=0xbffff184, result=@0xbffff120)
        at ../../../../gcc-3.4-CVS/libstdc++-v3/libsupc++/tinfo.cc:264
    #2  0x4006d0c3 in __dynamic_cast (src_ptr=0xbffff184, src_type=0x804a488, 
        dst_type=0x804a4a0, src2dst=-1)
        at ../../../../gcc-3.4-CVS/libstdc++-v3/libsupc++/tinfo.cc:712
    #3  0x08048703 in main () at x.cc:19
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9433


             reply	other threads:[~2003-01-24 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-24 15:22 bangerth [this message]
2003-01-27 21:58 nathan
2003-01-28 15:28 nathan

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=20030124152242.25959.qmail@sources.redhat.com \
    --to=bangerth@dealii.org \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    --cc=yanliu@ca.ibm.com \
    /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).