* gdbtypes.c (append_composite_type_field): Correct the location of
authorPedro Alves <palves@redhat.com>
Fri, 9 Jan 2009 17:41:53 +0000 (17:41 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 9 Jan 2009 17:41:53 +0000 (17:41 +0000)
appended fields.

gdb/ChangeLog
gdb/gdbtypes.c

index e2eeb67..9ddb709 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-09  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdbtypes.c (append_composite_type_field): Correct the location of
+       appended fields.
+
 2009-01-09  Pedro Alves  <pedro@codesourcery.com>
 
        * defs.h (deprecated_error_hook): Delete declaration.
index c4e3646..790442c 100644 (file)
@@ -1856,10 +1856,9 @@ append_composite_type_field (struct type *t, char *name,
     {
       TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
       if (TYPE_NFIELDS (t) > 1)
-       {
-         FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
-                                + TYPE_LENGTH (field) * TARGET_CHAR_BIT);
-       }
+       FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
+                              + (TYPE_LENGTH (FIELD_TYPE (f[-1]))
+                                 * TARGET_CHAR_BIT));
     }
 }