mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/9433 (SegFault in dynamic_cast)
libstdc++-v3:
PR c++/9433
* libsupc++/tinfo.cc (__vmi_class_type_info::__do_dyncast): Cope
with bases which are very ambiguous.
gcc/testsuite:
* g++.dg/abi/dcast1.C: New test.
From-SVN: r61973
This commit is contained in:
parent
a77b7e32ec
commit
483a570922
|
|
@ -1,3 +1,7 @@
|
||||||
|
2003-01-28 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
* g++.dg/abi/dcast1.C: New test.
|
||||||
|
|
||||||
2003-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
2003-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* gcc.c-torture/execute/builtin-constant.x: Only expect failure at -O1.
|
* gcc.c-torture/execute/builtin-constant.x: Only expect failure at -O1.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
|
// Contributed by Nathan Sidwell 28 Jan 2003 <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
// PR 9433. segfault at runtime.
|
||||||
|
|
||||||
|
struct A { virtual void f() {}; };
|
||||||
|
struct B {int b;};
|
||||||
|
struct C : A, B { virtual void f() {}; int c;};
|
||||||
|
struct D : C {int d;};
|
||||||
|
struct E : C {int e;};
|
||||||
|
struct F : protected D, E {int f;};
|
||||||
|
struct H : virtual F {int h;};
|
||||||
|
struct I : H {int i;};
|
||||||
|
struct J : H {int j;};
|
||||||
|
struct K : I, J { virtual void f() {}; int k; };
|
||||||
|
struct M : K {int m;};
|
||||||
|
struct N : M {int n;};
|
||||||
|
struct O : M {int o;};
|
||||||
|
struct P : N, O { virtual void f() {}; int p;};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
P obj;
|
||||||
|
A* a1 = (D *) (&obj);
|
||||||
|
H* hp = dynamic_cast<H*>(a1);
|
||||||
|
return hp != 0;
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
2003-01-28 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
PR c++/9433
|
||||||
|
* libsupc++/tinfo.cc (__vmi_class_type_info::__do_dyncast): Cope
|
||||||
|
with bases which are very ambiguous.
|
||||||
|
|
||||||
2003-01-28 Danny Smith <dannysmith@users.sourceforge.net>
|
2003-01-28 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
* src/Makefile.am (CONFIG_CXXFLAGS): Reverse order of
|
* src/Makefile.am (CONFIG_CXXFLAGS): Reverse order of
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
|
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
|
||||||
// Copyright (C) 1994, 1996, 1998, 1999, 2000, 2001, 2002
|
// Copyright (C) 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
// Free Software Foundation
|
// Free Software Foundation
|
||||||
//
|
//
|
||||||
// This file is part of GNU CC.
|
// This file is part of GNU CC.
|
||||||
|
|
@ -482,8 +482,9 @@ __do_dyncast (ptrdiff_t src2dst,
|
||||||
result.whole2dst =
|
result.whole2dst =
|
||||||
__sub_kind (result.whole2dst | result2.whole2dst);
|
__sub_kind (result.whole2dst | result2.whole2dst);
|
||||||
}
|
}
|
||||||
else if ((result.dst_ptr != 0 | result_ambig)
|
else if ((result.dst_ptr != 0 & result2.dst_ptr != 0)
|
||||||
&& (result2.dst_ptr != 0 | result2_ambig))
|
|| (result.dst_ptr != 0 & result2_ambig)
|
||||||
|
|| (result2.dst_ptr != 0 & result_ambig))
|
||||||
{
|
{
|
||||||
// Found two different DST_TYPE bases, or a valid one and a set of
|
// Found two different DST_TYPE bases, or a valid one and a set of
|
||||||
// ambiguous ones, must disambiguate. See whether SRC_PTR is
|
// ambiguous ones, must disambiguate. See whether SRC_PTR is
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue