class.c (build_vtbl_initializer): Adjust computation of new_position and which entry...
authorNathan Froyd <froydnj@codesourcery.com>
Wed, 16 Jun 2010 18:07:09 +0000 (18:07 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Wed, 16 Jun 2010 18:07:09 +0000 (18:07 +0000)
* class.c (build_vtbl_initializer): Adjust computation of new_position
and which entry to add padding for.

From-SVN: r160856

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

index 8402afd176e84c2a28a963601bae6a767e2f60b6..7456c82eee5648da35122df3b20cb3214590cff5 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-16  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * class.c (build_vtbl_initializer): Adjust computation of new_position
+       and which entry to add padding for.
+
 2010-06-16  Jason Merrill  <jason@redhat.com>
 
        * except.c (check_noexcept_r): Return the problematic function.
index 60908ffb5d5522f349773ee4f169216dd3fd937c..f945923ddc4d0d0de23f3eae3992bc3bffdba908 100644 (file)
@@ -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);