arm: correctly handle zero-sized bit-fields in AAPCS [PR102024]
authorRichard Earnshaw <rearnsha@arm.com>
Tue, 29 Mar 2022 09:24:49 +0000 (10:24 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Tue, 29 Mar 2022 16:37:15 +0000 (17:37 +0100)
commit3032df28f2a1cc6514571558b76d9b80373b19c6
tree8390eaa4c63e6aeb5509f665570fd38adbbc66ff
parent1dca4ca1bf2f1b05537a1052e373d8b0ff11e53c
arm: correctly handle zero-sized bit-fields in AAPCS [PR102024]

On arm the AAPCS 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/arm/arm.cc (aapcs_vfp_sub_candidate): Handle zero-sized
bit-fields.  Detect cases where a warning may be needed.
(aapcs_vfp_is_call_or_return_candidate): Emit a note if
a zero-sized bit-field has caused parameter passing to change.

gcc/testsuite/ChangeLog:

PR target/102024
* gcc.target/arm/aapcs/vfp26.c: New test.
gcc/config/arm/arm.cc
gcc/testsuite/gcc.target/arm/aapcs/vfp26.c [new file with mode: 0644]