Re: [PATCH] [gdb/testsuite] Fix gdb.arch/i386-avx.exp with clang

Andrew Burgess via Gdb-patches
2021-11-05T13:52:52Z

* Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> [2021-11-05 14:35:20 +0100]:

> On 11/5/21 2:20 PM, Pedro Alves wrote:
> > On 2021-11-05 13:15, Tom de Vries wrote:
> >> On 11/5/21 1:55 PM, Pedro Alves wrote:
> >>> On 2021-11-05 12:23, Tom de Vries via Gdb-patches wrote:
> >>>
> >>>>> No, but in gdb/testsuite/lib/attribute.h we do setup a compatibility
> >>>>> macro for 'noclone', so there's definitely precedent for using
> >>>>> attributes that might not be supported everywhere.
> >>>>>
> >>>>
> >>>> Right, I'm aware of this, but that's a typical case where we have no
> >>>> portable alternative.
> >>>
> >>> We actually do -- _Alignas is standard C11. This fixes the test as well:
> >>>
> >>> _Alignas(32) v8sf_t data[] =
> >>>
> >>
> >> I was referring to the noclone, but ok, I was not aware of the _Alignas,
> >> good to know, thanks.
> >>
> >> Anyway, in the latest version this is not relevant anymore, since the
> >> precise alignment implementation has an extra benefit, as explained in
> >> the post.
> >>
> >
> > OOC, is that benefit important here?
> >
>
> So, this is the post I mentioned (
> https://sourceware.org/pipermail/gdb-patches/2021-November/183183.html ).
>
> Well, the benefit is that it prevents accidental overalignment, which is
> the reason that this problem escaped detection and/or fixing for so long.
>
> Without that, I could do a thinko and specify too small an alignment and
> have the test passing accidentally, only to fail in a different setup.

I'm still not convinced. The test doesn't appear to be about the
alignment, but about accessing the feature specific registers, so I
don't see how making a mistake with the alignment would be different
to any other bug - eventually it gets spotted and fixed.

Thanks,
Andrew