[Dwarf-Discuss] EXTERNAL: Corner-cases with bitfields

Michael Eager eager at eagercon.com
Tue May 10 09:11:14 PDT 2022


On 5/10/22 02:15, Pedro Alves via Dwarf-Discuss wrote:
>   But still, at the language level, the types ARE different.  And DWARF is
> also about language source to machine code mapping.  C/C++ don't let you take the
> address of a bitfield, for example, so it's possible type expressions in the
> debugger that behave differently depending on what the DWARF described.

In a previous email in this thread, I mentioned that I thought "char a;"
and "char a:8" in a struct were equivalent.  I forgot about the
restriction on using the address operator, mentioned in ISO C Sect.
6.5.3.2 (at least, in the old copy I have).  They are not equivalent.
Thanks for reminding me.

> So in my view, you'd want a producer to always indicate that the field
> is a bitfield somehow, even if the memory layout wouldn't change, i.e.,
> regardless of ABI.
> 
> Maybe we can convince Clang folks of the same as GCC, that certainly sounds simpler,
> but I figured that maybe there would be agreement that the spec itself should be tweaked
> in this direction, if every producer would come to the same conclusion.

It's better to propose a change to the DWARF Standard.

You can submit a proposal on the Public Comment page:
https://dwarfstd.org/Comment.php.  Describe the issue briefly and, if
possible, please specify the change to the wording of the DWARF
Standard that would think appropriate.

-- 
Michael Eager


More information about the Dwarf-Discuss mailing list