From: Jeffrey A Law Date: Fri, 2 Jul 1999 02:07:28 +0000 (+0000) Subject: dwarfout.c (field_byte_offset): Correctly compute the object's byte offset for the... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=84d594532534434f54c8b2476482316c41abd164;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8bdff9c99e9..c3ef1de4260 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Fri Jul 2 03:05:44 1999 Jeffrey A Law (law@cygnus.com) + + * 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. + Fri Jul 2 01:36:36 1999 Robert Lipe * fixinc.svr4: Fix by deleting protos for htons and diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 2a1b482f8f8..9c419a8bca1 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