This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] DWARFv5 DW_TAG_aligned_type.
- From: Mark Wielaard <mjw at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Fri, 18 Jul 2014 00:19:16 +0200
- Subject: Re: [PATCH] DWARFv5 DW_TAG_aligned_type.
- Authentication-results: sourceware.org; auth=none
- References: <1404944457-4500-1-git-send-email-mjw at redhat dot com> <20140711144227 dot GB4888 at adacore dot com>
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
> blindly?
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?
Thanks,
Mark