[PATCH] DWARFv5 DW_TAG_aligned_type.
Thu Jul 17 22:25:00 GMT 2014
On Fri, 2014-07-11 at 07:42 -0700, Joel Brobecker wrote:
> My only question is regarding the checks for alignments to be stricter
> than the alignment of their base types. Why are they needed? I am asking
> because, in Ada, it is allowed to be specifying an alignment which is
> less strict than the standard alignment. We can ask for byte-aligned
> integers, for instance. If I understand your patch correctly, the base
> type will have no alignment attribute, and therefore the 1-byte
> alignment attribute will be accepted. So my guess is that those checks
> are implementing requirements of the proposed DWARF extension. This
> leads me to ask why that's necessary? Shouldn't the compiler be able
> to provide the actual alignement allowing consumers to just follow it
They do that because it assumes the proposed DWARF extension requires
interpreting "layered" user alignments as if they follow C semantics.
But you are right that should not be necessary. I just hadn't considered
anything else than the C semantics when writing the code. Sorry.
We do need to specify what it means when you have a type that is wrapped
in multiple (different) user alignment tags. We could either say that
has to be resolved by the consumer based on the semantics dictated by
the DW_AT_language of the compile unit. Or we could say that a producer
is responsible for interpreting the language semantics by making sure
that the "outer" user alignment overrides any other user alignment tags
(so in the C case, the producer would NOT add an extra user alignment
tag, unless it was stricter than any existing ones for the underlying
type). I think my preference is to do the second, make the producer
responsible. What do you think?
More information about the Gdb-patches