]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarfout.c (field_byte_offset): Correctly compute the object's byte offset for the...
authorJeffrey A Law <law@cygnus.com>
Fri, 2 Jul 1999 02:06:56 +0000 (02:06 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 2 Jul 1999 02:06:56 +0000 (20:06 -0600)
        * 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: r27920

gcc/ChangeLog
gcc/dwarfout.c

index ab24dcb00dd7a9a8113c66bc51588c8ff81db5b7..be65273f0545d3080feed414ff7a867a71ee25b9 100644 (file)
@@ -1,3 +1,9 @@
+Fri Jul  2 03:05:13 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  <robertlipe@usa.net>
 
        * fixinc.svr4: Fix <arpa/inet.h> by deleting protos for htons and
index 2a1b482f8f8e774f6a44b7bdb95b7ce3c059cd61..9c419a8bca1df1ea93a409d9c4db78621a5b2549 100644 (file)
@@ -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