diff mbox

[c++] rewrite vtable initialization construction to use VECs

Message ID 20100616180722.GF27105@codesourcery.com
State New
Headers show

Commit Message

Nathan Froyd June 16, 2010, 6:07 p.m. UTC
On Wed, Jun 16, 2010 at 10:21:07AM -0700, Steve Ellcey wrote:
> I finished a full bootstrap and test of the last patch you sent me and
> it looks good on IA64 HP-UX.

Thanks for doing this and bearing with me on the remote debugging.  I
have committed the patch below as r160856.

-Nathan

	* class.c (build_vtbl_initializer): Adjust computation of new_position
	and which entry to add padding for.

Index: ChangeLog
===================================================================
diff mbox

Patch

Index: class.c
===================================================================
--- class.c	(revision 160853)
+++ class.c	(working copy)
@@ -7607,14 +7607,15 @@  build_vtbl_initializer (tree binfo,
 	   ix--)
 	{
 	  int j;
-	  int new_position = TARGET_VTABLE_DATA_ENTRY_DISTANCE * ix;
+	  int new_position = (TARGET_VTABLE_DATA_ENTRY_DISTANCE * ix
+			      + (TARGET_VTABLE_DATA_ENTRY_DISTANCE - 1));
 
 	  VEC_replace (constructor_elt, vid.inits, new_position, e);
 
 	  for (j = 1; j < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++j)
 	    {
-	      constructor_elt *f = VEC_index (constructor_elt, *inits,
-					      new_position + j);
+	      constructor_elt *f = VEC_index (constructor_elt, vid.inits,
+					      new_position - j);
 	      f->index = NULL_TREE;
 	      f->value = build1 (NOP_EXPR, vtable_entry_type,
 				 null_pointer_node);