diff options
author | Jeffrey A Law <law@cygnus.com> | 1999-07-02 02:07:28 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-07-01 20:07:28 -0600 |
commit | 84d594532534434f54c8b2476482316c41abd164 (patch) | |
tree | 4b7fed61e920b41d368b481f726229b1eb4530f1 /gcc/dwarfout.c | |
parent | 92080f30a2a71f0555bfb7fc433cc1a030141e24 (diff) | |
download | gcc-84d594532534434f54c8b2476482316c41abd164.zip gcc-84d594532534434f54c8b2476482316c41abd164.tar.gz gcc-84d594532534434f54c8b2476482316c41abd164.tar.bz2 |
dwarfout.c (field_byte_offset): Correctly compute the object's byte offset for the first bit of a field which...
* dwarfout.c (field_byte_offset): Correctly compute the object's
byte offset for the first bit of a field which crosses an alignment
boundary on a !BYTES_BIG_ENDIAN target.
From-SVN: r27921
Diffstat (limited to 'gcc/dwarfout.c')
-rw-r--r-- | gcc/dwarfout.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 2a1b482..9c419a8 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -2106,8 +2106,16 @@ field_byte_offset (decl) negative. Gdb fails when given negative bit offsets. We avoid this by recomputing using the first bit of the bitfield. This will give us an object which does not completely contain the bitfield, but it - will be aligned, and it will contain the first bit of the bitfield. */ - if (object_offset_in_bits > bitpos_int) + will be aligned, and it will contain the first bit of the bitfield. + + However, only do this for a BYTES_BIG_ENDIAN target. For a + ! BYTES_BIG_ENDIAN target, bitpos_int + field_size_in_bits is the first + first bit of the bitfield. If we recompute using bitpos_int + 1 below, + then we end up computing the object byte offset for the wrong word of the + desired bitfield, which in turn causes the field offset to be negative + in bit_offset_attribute. */ + if (BYTES_BIG_ENDIAN + && object_offset_in_bits > bitpos_int) { deepest_bitpos = bitpos_int + 1; object_offset_in_bits |