This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9629: [3.2/3.3/3.4 regression] virtual inheritance segfault
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, stefan at space dot twc dot de
- Date: 14 Feb 2003 20:46:19 -0000
- Subject: Re: c++/9629: [3.2/3.3/3.4 regression] virtual inheritance segfault
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, stefan at space dot twc dot de, gcc-gnats at gcc dot gnu dot org
Old Synopsis: virtual inheritance segfault
New Synopsis: [3.2/3.3/3.4 regression] virtual inheritance segfault
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Feb 14 20:46:18 2003
State-Changed-Why:
Confirmed. Here's a very slightly reduced testcase:
--------------------------
struct A { };
struct B {
B(A *) {}
};
struct C : virtual public A, public B {
C() : B(this) {}
};
struct D : virtual public C {};
main() {
new D();
}
------------------------
Executing this program segfaults with 3.2.2, 3.3, and 3.4.
So it is a regression, assuming the code is legal.
The problem is in casting this to A* in the constructor
C::C. It's trying to cast to a virtual base, and it seems
to me that this information is not available at the time
we get to C::C, which then causes the segfault. But that's
just a wild guess.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9629