[PATCH] D82881: [DEBUGINFO]Fix debug info for packed bitfields.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 05:54:52 PDT 2020


ABataev marked an inline comment as done.
ABataev added a comment.

In D82881#2123970 <https://reviews.llvm.org/D82881#2123970>, @aprantl wrote:

> I see that you are modifying the DWARF v2 codepath. The output emitted in DWARF v2 for bitfields on x86 is peculiar unintuitive because the spec was written with big-endian machines in mind. Have you verified (e.g., on https://godbolt.org) that GCC does the same thing?


gcc acts the same way just like llvm does. But seems to me, it is incorrect. In llvm, the bitfield consumes 2 bytes, but debug info says that it consumes only one bytes and emits negative offset. It may break debug info for some targets, like NVPTX.
I checked the new debug info, it works correctly with gdb.



================
Comment at: llvm/test/DebugInfo/X86/packed_bitfields.ll:11
 ; Note that DWARF 2 counts bit offsets backwards from the high end of
 ; the storage unit to the high end of the bit field.
 
----------------
aprantl wrote:
> Actually, this is weird. The comment mentions DWARF 2, but the RUN line seems to use the default, which is 4 at the moment. We might want to make sure to test both.
I will add the run line for both.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82881/new/

https://reviews.llvm.org/D82881





More information about the llvm-commits mailing list