From: Nathan Sidwell Date: Thu, 14 Jun 2001 10:48:20 +0000 (+0000) Subject: class.c (dfs_accumulate_vtbl_inits): For case 2 & 3... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87326ba8886677de714e2e764adb248e3f8bfe9f;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee62669ae6c..f02f7fa8ced 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-06-14 Nathan Sidwell + + * 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 * NEWS: Update release number. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c1347b3cb33..1fbf8d04e68 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 017ab7dec1e..8a767a52f3a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-06-14 Nathan Sidwell + + * g++.old-deja/g++.abi/vbase8-9.C: New test. + 2001-06-13 Franz Sirl * lib/objc.exp (objc_target_compile): Add ${rootme} to ld_library_path diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vbase8-9.C b/gcc/testsuite/g++.old-deja/g++.abi/vbase8-9.C new file mode 100644 index 00000000000..43bd86a968c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.abi/vbase8-9.C @@ -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 + +// 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; +}