[cfe-users] DWARF bit field offset wrong values in LLVM
Trevor Harrison via cfe-users
cfe-users at lists.llvm.org
Mon Jul 1 09:17:14 PDT 2019
I'm trying to extract information about bitfields in a structure using
The info generated by LLVM seems to be incorrect and not following the
If this isn't the right mailing list, please let me know.
If you look at DwarfUnit.cpp in the current LLVM src, it is using
DIDerivedType.getOffsetInBits() for the value of DW_AT_data_bit_offset.
The DWARF standard states that the bit offset: "is the offset in bits from
the beginning of the containing storage to the beginning of the value",
meaning the field the bitfield is packed in, not the structure holding the
As a result of this, the values that LLVM emit are completely out of line
with the values that I'm seeing come from gcc.
(Of course, you can't use a naive example where the bitfields are at the
beginning of the struct to test this, they need to occur later in the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-users