class.c (dfs_accumulate_vtbl_inits): For case 2 & 3...

cp:
	* class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure
	we've not emerged from the hierarchy of RTTI_BINFO on reaching
	a non-virtual base.
testsuite:
	* g++.old-deja/g++.abi/vbase8-9.C: New test.

From-SVN: r43368
This commit is contained in:
Nathan Sidwell 2001-06-14 10:48:20 +00:00 committed by Nathan Sidwell
parent c6036a3787
commit 87326ba888
4 changed files with 107 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
* class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure
we've not emerged from the hierarchy of RTTI_BINFO on reaching
a non-virtual base.
2001-06-13 Mark Mitchell <mark@codesourcery.com>
* NEWS: Update release number.

View File

@ -7564,7 +7564,7 @@ accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, inits)
BINFO_TYPE (orig_binfo)),
20000517);
/* If it doesn't have a vpte, we don't do anything. */
/* If it doesn't have a vptr, we don't do anything. */
if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
return;
@ -7675,14 +7675,32 @@ dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
still be primary to something within a lost primary
virtual base of RTTI_BINFO. */
tree b;
tree last, orig_last;
tree last = binfo;
tree orig_last = orig_binfo;
/* First, look through the bases we are primary to for a
virtual base. */
for (b = BINFO_PRIMARY_BASE_OF (binfo), orig_last = orig_binfo;
for (b = BINFO_PRIMARY_BASE_OF (binfo);
b;
b = BINFO_PRIMARY_BASE_OF (b))
{
if (!TREE_VIA_VIRTUAL (b))
{
/* See if B is still within the hierarchy starting
at RTTI_BINFO. */
tree probe;
for (probe = b; probe;
probe = BINFO_INHERITANCE_CHAIN (probe))
if (probe == rtti_binfo)
break;
if (!probe)
{
b = NULL_TREE;
break;
}
}
last = b;
if (orig_last)
orig_last = BINFO_PRIMARY_BASE_OF (orig_last);

View File

@ -1,3 +1,7 @@
2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.abi/vbase8-9.C: New test.
2001-06-13 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* lib/objc.exp (objc_target_compile): Add ${rootme} to ld_library_path

View File

@ -0,0 +1,76 @@
// Special g++ Options: -ansi -pedantic-errors -w
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Jun 2001 <nathan@codesourcery.com>
// Bug 3145, generated by script provided by stefan@space.twc.de
// This is case number 9
class C0
{};
class C1
: public C0
{};
class C2
: public C1
, public C0
{};
class C3
: virtual public C0
, public C2
, virtual public C1
{};
class C4
: virtual public C2
, public C0
, virtual public C3
, public C1
{};
class C5
: public C0
, public C1
, public C4
, virtual public C2
, public C3
{};
class C6
: public C1
, public C3
, virtual public C5
, virtual public C2
, public C0
, virtual public C4
{};
class C7
: virtual public C1
, virtual public C0
, public C6
, virtual public C2
, public C5
{};
class C8
: virtual public C1
, virtual public C4
, public C0
, virtual public C7
, virtual public C2
{};
class C9
: virtual public C1
, virtual public C6
, public C8
, virtual public C2
, public C0
{};
int main() {
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
}