On Tue, Apr 25, 2017 at 01:29:06PM +0100, Richard Earnshaw (lists) wrote:
> >        /* C.8 if the argument has an alignment of 16 then the NGRN is
> >           rounded up to the next even number.  */
> > -      if (nregs == 2 && alignment == 16 * BITS_PER_UNIT && ncrn % 2)
> > +      if (nregs == 2 && ncrn % 2)
> >     {
> > -     ++ncrn;
> > -     gcc_assert (ncrn + nregs <= NUM_ARG_REGS);
> > +     struct aarch64_fn_arg_alignment aa
> > +       = aarch64_function_arg_alignment (mode, type);
> > +
> > +     if (aa.warn_alignment == 16 * BITS_PER_UNIT
> 
> I was caught out (again) when reviewing this as to why the test was for
> exactly 16 bytes and not >= 16.  I'd forgotten that anything with higher
> alignment would have a size larger than 16 and thus be passed by

I admit I didn't know why it has been written that way, I was just trying
to write something that would do the same as before if ignoring the
non-FIELD_DECL alignments and warn for the cases that changed ABI;
as there was originally alignment == 16 * BITS_PER_UNIT, I kept using that.
For structs/classes indeed I think alignment of any fields > 16
bytes implies struct size of > 16.  The ARRAY_TYPE case is for some
languages I'm not familiar with, in C/C++/Fortran that doesn't happen, so I
can't guess what those languages can do.  And otherwise it uses mode
alignment or alignment of main variant of scalar/vector/complex types and
I believe those should never be over-aligned.

> reference to a copy.  Could you please add a comment to that effect as
> it's not obvious at this point.

Ok.

        Jakub

Reply via email to