On Tue, Mar 29, 2022 at 04:32:11PM +0100, Richard Earnshaw wrote:
>
> On aarch64 the AAPCS64 states that an HFA is determined by the 'shape' of
> the object after layout has been completed, so anything that adds no
> members and does not cause the layout to be modified should be ignored
> for the purposes of determining which registers are used for parameter
> passing.
>
> A zero-sized bit-field falls into this category. This was not handled
> correctly for C structs and in G++-11 only handled correctly because
> such fields were eliminated early by the front end.
>
> gcc/ChangeLog:
>
> PR target/102024
> * config/aarch64/aarch64.cc (aapcs_vfp_sub_candidate): Handle
> zero-sized bit-fields. Detect cases where a warning may be needed.
> (aarch64_vfp_is_call_or_return_candidate): Emit a note if a
> zero-sized bit-field has caused parameter passing to change.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/aarch64/aapcs64/test_28.c: New test.
> ---
> gcc/config/aarch64/aarch64.cc | 35 +++++++++++++++++--
> .../gcc.target/aarch64/aapcs64/test_28.c | 28 +++++++++++++++
> 2 files changed, 60 insertions(+), 3 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_28.c
>
> @@ -19711,8 +19734,10 @@ aarch64_vfp_is_call_or_return_candidate
> (machine_mode mode,
> && ((alt = aapcs_vfp_sub_candidate (type, &new_mode, NULL))
> != ag_count))
> {
> - const char *url
> + const char *url10
> = CHANGES_ROOT_URL "gcc-10/changes.html#empty_base";
> + const char *url12
> + = CHANGES_ROOT_URL "gcc-12/changes.html#empty_base";
Again, #zero_width_bitfields
Otherwise LGTM.
Jakub