class.c (layout_vtable_decl): Fix off by one error on build_index_type.
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 5 Jun 2001 11:53:28 +0000 (11:53 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 5 Jun 2001 11:53:28 +0000 (11:53 +0000)
* class.c (layout_vtable_decl): Fix off by one error on
build_index_type.
(build_vtt): Likewise.
(build_ctor_vtbl_group): Likewise.

From-SVN: r42903

gcc/cp/ChangeLog
gcc/cp/class.c

index 8f5ebaa..94658ac 100644 (file)
@@ -1,5 +1,12 @@
 2001-06-05  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * class.c (layout_vtable_decl): Fix off by one error on
+       build_index_type.
+       (build_vtt): Likewise.
+       (build_ctor_vtbl_group): Likewise.
+
+2001-06-05  Nathan Sidwell  <nathan@codesourcery.com>
+
        * class.c (maybe_indent_hierarchy): New function.
        (dump_class_hierarchy_r): Add flags. Dump extra binfo
        information, if enabled. Use maybe_indent_hierarchy. Adjust
index 7a7f69b..afe2da4 100644 (file)
@@ -2446,13 +2446,11 @@ layout_vtable_decl (binfo, n)
      tree binfo;
      int n;
 {
-  tree itype;
   tree atype;
   tree vtable;
 
-  itype = size_int (n);
   atype = build_cplus_array_type (vtable_entry_type, 
-                                 build_index_type (itype));
+                                 build_index_type (size_int (n - 1)));
   layout_type (atype);
 
   /* We may have to grow the vtable.  */
@@ -4856,7 +4854,7 @@ layout_virtual_bases (t, offsets)
   TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT);
 
   /* Go through the virtual bases, allocating space for each virtual
-     base that is not already a primary base class.  Under the new
+     base that is not already a primary base class.  Under the old
      ABI, these are allocated according to a depth-first left-to-right
      postorder traversal; in the new ABI, inheritance graph order is
      used instead.  */
@@ -7149,7 +7147,7 @@ build_vtt (t)
     return;
 
   /* Figure out the type of the VTT.  */
-  type = build_index_type (size_int (list_length (inits)));
+  type = build_index_type (size_int (list_length (inits) - 1));
   type = build_cplus_array_type (const_ptr_type_node, type);
                                 
   /* Now, build the VTT object itself.  */
@@ -7468,7 +7466,7 @@ build_ctor_vtbl_group (binfo, t)
   inits = TREE_VALUE (list);
 
   /* Figure out the type of the construction vtable.  */
-  type = build_index_type (size_int (list_length (inits)));
+  type = build_index_type (size_int (list_length (inits) - 1));
   type = build_cplus_array_type (vtable_entry_type, type);
   TREE_TYPE (vtbl) = type;