On Mon, Jul 14, 2014 at 2:54 PM, Ulrich Weigand <uweig...@de.ibm.com> wrote:
> Hello,
>
> this patch updates the prior version:
> https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00634.html
> to add a -Wpsabi note as discussed.
>
> Note that the warning triggers whenever type is encountered whose alignment
> *requirement* changes due to this patch.  In some cases, this does not 
> actually
> change the ABI of a given function call since the argument happened to be
> already aligned for the higher requirement as well.
>
> Except for a few cases in the ABI compat suite (as expected), this note
> triggers in three test cases:
>
> In the ELFv1 ABI only:
> gcc.c-torture/compile/20040709-1.c:7:1: note: the ABI of passing aggregates 
> with 16-byte alignment has changed in GCC 4.10
> union foo {
>   long double ld;
> } bar;
>
> Note that this union counts as homogeneous aggregate according to
> the ELFv2 ABI, so it is treated the same before and after this patch
> (i.e. aligned to 8 bytes).
>
> In the ELFv1 ABI, however, this union does *not* count as a single-element
> float struct (because its mode is TImode, not TFmode, since common code
> does the latter only for single-element structs, not unions).  Therefore,
> this union used to be 8-byte aligned but is now 16-byte aligned.
>
> In both the ELFv1 and ELFv2 ABIs:
> gcc.dg/pr32293.c:46:1: note: the ABI of passing aggregates with 16-byte 
> alignment has changed in GCC 4.10
> typedef
> __attribute__ ((aligned(16)))
>      struct {
>        UINT64 w[2];
>      } UINT128;
>
> g++.dg/abi/param2.C:9:1: note: the ABI of passing aggregates with 16-byte 
> alignment has changed in GCC 4.10
> struct S { union {} a; } __attribute__((aligned));
>
> In both cases, we have a struct of size 16 bytes (in the second case due to
> alignment padding) and alignment requirement 16 bytes, which is recognized
> as TImode and not BLKmode by common code, and thus used to be 8-byte aligned
> but is now 16-byte aligned.
>
> The tests still PASS since the dg-test infrastructure prunes all informational
> messages from the GCC output.
>
> Based on the discussion after the previous patch submission, the patch
> leaves the Darwin ABI unchanged.
>
> Tested on powerpc64-linux and powerpc64le-linux.
>
> OK for mainline?
>
> Bye,
> Ulrich
>
>
> gcc/ChangeLog:
>
>         * config/rs6000/rs6000.c (rs6000_function_arg_boundary): In the AIX
>         and ELFv2 ABI, do not use the "mode == BLKmode" check to test for
>         aggregate types.  Instead, *all* aggregate types, except for single-
>         element or homogeneous float/vector aggregates, are quadword-aligned
>         if required by their type alignment.  Issue -Wpsabi note when a type
>         is now treated differently than before.
>
> gcc/testsuite/ChangLog:
>
>         * gcc.target/powerpc/ppc64-abi-warn-2.c: New test.

This patch is okay.

Thanks, David

Reply via email to