]> gcc.gnu.org Git - gcc.git/commit
aarch64: fix warning emission for ABI break since GCC 9.1
authorChristophe Lyon <christophe.lyon@arm.com>
Tue, 14 Jun 2022 21:08:33 +0000 (21:08 +0000)
committerChristophe Lyon <christophe.lyon@arm.com>
Thu, 12 Jan 2023 13:42:00 +0000 (14:42 +0100)
commit3df1a115be22caeab3ffe7afb12e71adb54ff132
tree0e8f83dd063f2b8e077ae6a4fc21a0006a6b5d35
parentb073f2b098ba7819450d6c14a0fb96cb1c09f242
aarch64: fix warning emission for ABI break since GCC 9.1

While looking at PR 105549, which is about fixing the ABI break
introduced in GCC 9.1 in parameter alignment with bit-fields, we
noticed that the GCC 9.1 warning is not emitted in all the cases where
it should be.  This patch fixes that and the next patch in the series
fixes the GCC 9.1 break.

We split this into two patches since patch #2 introduces a new ABI
break starting with GCC 13.1.  This way, patch #1 can be back-ported
to release branches if needed to fix the GCC 9.1 warning issue.

The main idea is to add a new global boolean that indicates whether
we're expanding the start of a function, so that aarch64_layout_arg
can emit warnings for callees as well as callers.  This removes the
need for aarch64_function_arg_boundary to warn (with its incomplete
information).  However, in the first patch there are still cases where
we emit warnings were we should not; this is fixed in patch #2 where
we can distinguish between GCC 9.1 and GCC.13.1 ABI breaks properly.

The fix in aarch64_function_arg_boundary (replacing & with &&) looks
like an oversight of a previous commit in this area which changed
'abi_break' from a boolean to an integer.

We also take the opportunity to fix the comment above
aarch64_function_arg_alignment since the value of the abi_break
parameter was changed in a previous commit, no longer matching the
description.

2022-11-28  Christophe Lyon  <christophe.lyon@arm.com>
    Richard Sandiford  <richard.sandiford@arm.com>

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Fix
comment.
(aarch64_layout_arg): Factorize warning conditions.
(aarch64_function_arg_boundary): Fix typo.
* function.cc (currently_expanding_function_start): New variable.
(expand_function_start): Handle
currently_expanding_function_start.
* function.h (currently_expanding_function_start): Declare.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: New test.
* gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: New
test.
* gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: New test.
* gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: New
test.
* gcc.target/aarch64/bitfield-abi-warning-align8-O2.c: New test.
* gcc.target/aarch64/bitfield-abi-warning.h: New test.
* g++.target/aarch64/bitfield-abi-warning-align16-O2.C: New test.
* g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: New
test.
* g++.target/aarch64/bitfield-abi-warning-align32-O2.C: New test.
* g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: New
test.
* g++.target/aarch64/bitfield-abi-warning-align8-O2.C: New test.
* g++.target/aarch64/bitfield-abi-warning.h: New test.
15 files changed:
gcc/config/aarch64/aarch64.cc
gcc/function.cc
gcc/function.h
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/bitfield-abi-warning.h [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning.h [new file with mode: 0644]
This page took 0.106078 seconds and 5 git commands to generate.