* rtti.c (get_base_offset): Cope when vbase field is in a base.
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 20 Jun 2000 16:13:33 +0000 (16:13 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 20 Jun 2000 16:13:33 +0000 (16:13 +0000)
From-SVN: r34619

gcc/cp/ChangeLog
gcc/cp/rtti.c

index b4167416a3c21db399d4843361edd7a2fb65acfa..3be1d2afcbd6e1ae1858e00c2ccf24d7c064830c 100644 (file)
@@ -1,3 +1,7 @@
+2000-06-20  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * rtti.c (get_base_offset): Cope when vbase field is in a base.
+
 2000-06-20  Nathan Sidwell  <nathan@codesourcery.com>
 
        * call.c (build_conditional_expr): Use VOID_TYPE_P.
index 8bf17d985abde3d74fd63a159afad07329c4db61..98a4582e30893a7e5ccbecc18e66a5149a6af94e 100644 (file)
@@ -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