summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authoraburgess <aburgess>2011-06-23 09:51:57 +0000
committeraburgess <aburgess>2011-06-23 09:51:57 +0000
commitbb3731548742ddcd7a0e97dc8204e0a5c821926f (patch)
tree388dab9fa54b282f2cd936552d51327ac27fb7e3 /gdb/gdbtypes.c
parentc205f924b3bfe0da2917be3b7efdc123afe72f09 (diff)
downloadgdb-bb3731548742ddcd7a0e97dc8204e0a5c821926f.tar.gz
http://sourceware.org/ml/gdb-patches/2011-06/msg00136.html
2011-06-23 Andrew Burgess <aburgess@broadcom.com> * gdbtypes.c (append_composite_type_field_aligned): Fix calculation of bit position based on alignment.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2bdb4ebe72d..2572046e39c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3654,12 +3654,15 @@ append_composite_type_field_aligned (struct type *t, char *name,
if (alignment)
{
- int left = FIELD_BITPOS (f[0]) % (alignment * TARGET_CHAR_BIT);
+ int left;
+
+ alignment *= TARGET_CHAR_BIT;
+ left = FIELD_BITPOS (f[0]) % alignment;
if (left)
{
- FIELD_BITPOS (f[0]) += left;
- TYPE_LENGTH (t) += left / TARGET_CHAR_BIT;
+ FIELD_BITPOS (f[0]) += (alignment - left);
+ TYPE_LENGTH (t) += (alignment - left) / TARGET_CHAR_BIT;
}
}
}