From fc99f62c11b3270205d7ead548879f0a28d6ceff Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 20 Jun 2000 16:13:33 +0000 Subject: [PATCH] * rtti.c (get_base_offset): Cope when vbase field is in a base. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34619 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/rtti.c | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b4167416a3c..3be1d2afcbd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2000-06-20 Nathan Sidwell + * rtti.c (get_base_offset): Cope when vbase field is in a base. + +2000-06-20 Nathan Sidwell + * call.c (build_conditional_expr): Use VOID_TYPE_P. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_void): Likewise. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 8bf17d985ab..98a4582e308 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -549,10 +549,25 @@ get_base_offset (binfo, parent) else if (! vbase_offsets_in_vtable_p ()) { const char *name; + tree result; + tree field; FORMAT_VBASE_NAME (name, BINFO_TYPE (binfo)); - return byte_position (lookup_field (parent, get_identifier (name), - 0, 0)); + field = lookup_field (parent, get_identifier (name), 0, 0); + result = byte_position (field); + + if (DECL_CONTEXT (field) != parent) + { + /* The vbase pointer might be in a non-virtual base of PARENT. + * Adjust for the offset of that base in PARENT. */ + tree path; + + get_base_distance (DECL_CONTEXT (field), parent, -1, &path); + result = build (PLUS_EXPR, TREE_TYPE (result), + result, BINFO_OFFSET (path)); + result = fold (result); + } + return result; } else /* Under the new ABI, we store the vtable offset at which -- 2.11.0