aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-06-20 16:13:33 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-06-20 16:13:33 +0000
commit0f1e25b0d72e2ed1acda264536f5fa35df873bd2 (patch)
treea8088da6ac4e468c49239cf037522fcfc34891e3 /gcc/cp/rtti.c
parent21b9069137d3a26069aa7fef10aedb94bfc3c657 (diff)
downloadgcc-0f1e25b0d72e2ed1acda264536f5fa35df873bd2.zip
gcc-0f1e25b0d72e2ed1acda264536f5fa35df873bd2.tar.gz
gcc-0f1e25b0d72e2ed1acda264536f5fa35df873bd2.tar.bz2
* rtti.c (get_base_offset): Cope when vbase field is in a base.
From-SVN: r34619
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 8bf17d9..98a4582 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