From: nathan Date: Tue, 5 Jun 2001 11:53:28 +0000 (+0000) Subject: * class.c (layout_vtable_decl): Fix off by one error on X-Git-Tag: upstream/4.9.2~93981 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82ef7cb53c54e23bbe348addc4c390e0e59e41e5;p=platform%2Fupstream%2Flinaro-gcc.git * class.c (layout_vtable_decl): Fix off by one error on build_index_type. (build_vtt): Likewise. (build_ctor_vtbl_group): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42903 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f5ebaa..94658ac 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 2001-06-05 Nathan Sidwell + * 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 + * class.c (maybe_indent_hierarchy): New function. (dump_class_hierarchy_r): Add flags. Dump extra binfo information, if enabled. Use maybe_indent_hierarchy. Adjust diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7a7f69b..afe2da4 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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;