Go to file
Christophe Lyon 6610daa1cf aarch64: Fix bit-field alignment in param passing [PR105549]
While working on enabling DFP for AArch64, I noticed new failures in
gcc.dg/compat/struct-layout-1.exp (t028) which were not actually
caused by DFP types handling. These tests are generated during 'make
check' and enabling DFP made generation different (not sure if new
non-DFP tests are generated, or if existing ones are generated
differently, the tests in question are huge and difficult to compare).

Anyway, I reduced the problem to what I attach at the end of the new
gcc.target/aarch64/aapcs64/va_arg-17.c test and rewrote it in the same
scheme as other va_arg* AArch64 tests.  Richard Sandiford further
reduced this to a non-vararg function, added as a second testcase.

This is a tough case mixing bit-fields and alignment, where
aarch64_function_arg_alignment did not follow what its descriptive
comment says: we want to use the natural alignment of the bit-field
type only if the user didn't reduce the alignment for the bit-field
itself.

The patch also adds a comment and assert that would help someone who
has to look at this area again.

The fix would be very small, except that this introduces a new ABI
break, and we have to warn about that.  Since this actually fixes a
problem introduced in GCC 9.1, we keep the old computation to detect
when we now behave differently.

This patch adds two new tests (va_arg-17.c and
pr105549.c). va_arg-17.c contains the reduced offending testcase from
struct-layout-1.exp for reference.  We update some tests introduced by
the previous patch, where parameters with bit-fields and packed
attribute now emit a different warning.

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

	gcc/
	PR target/105549
	* config/aarch64/aarch64.cc (aarch64_function_arg_alignment):
	Check DECL_PACKED for bitfield.
	(aarch64_layout_arg): Warn when parameter passing ABI changes.
	(aarch64_function_arg_boundary): Do not warn here.
	(aarch64_gimplify_va_arg_expr): Warn when parameter passing ABI
	changes.

	gcc/testsuite/
	PR target/105549
	* gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: Update.
	* gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: Update.
	* gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: Update.
	* gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: Update.
	* gcc.target/aarch64/aapcs64/va_arg-17.c: New test.
	* gcc.target/aarch64/pr105549.c: New test.
	* g++.target/aarch64/bitfield-abi-warning-align16-O2.C: Update.
	* g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: Update.
	* g++.target/aarch64/bitfield-abi-warning-align32-O2.C: Update.
	* g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: Update.
2023-01-12 14:43:41 +01:00
c++tools Daily bump. 2023-01-10 00:18:07 +00:00
config Daily bump. 2022-11-15 08:32:29 +00:00
contrib Daily bump. 2023-01-12 00:18:07 +00:00
fixincludes Daily bump. 2022-11-24 00:17:47 +00:00
gcc aarch64: Fix bit-field alignment in param passing [PR105549] 2023-01-12 14:43:41 +01:00
gnattools Daily bump. 2022-09-01 00:17:39 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2022-12-22 00:17:29 +00:00
INSTALL
intl Daily bump. 2022-11-24 00:17:47 +00:00
libada Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libatomic Daily bump. 2023-01-08 00:16:59 +00:00
libbacktrace Daily bump. 2023-01-07 00:17:28 +00:00
libcc1 Daily bump. 2022-11-02 00:17:38 +00:00
libcody Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libcpp Daily bump. 2023-01-10 00:18:07 +00:00
libdecnumber Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libffi Daily bump. 2023-01-08 00:16:59 +00:00
libgcc Daily bump. 2023-01-08 00:16:59 +00:00
libgfortran Daily bump. 2023-01-08 00:16:59 +00:00
libgm2 Daily bump. 2023-01-07 00:17:28 +00:00
libgo Always define WIN32_LEAN_AND_MEAN before <windows.h> 2023-01-07 06:51:06 +00:00
libgomp Daily bump. 2023-01-08 00:16:59 +00:00
libiberty Daily bump. 2023-01-08 00:16:59 +00:00
libitm Daily bump. 2023-01-03 00:17:09 +00:00
libobjc Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libphobos Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libquadmath Daily bump. 2023-01-03 00:17:09 +00:00
libsanitizer Daily bump. 2022-12-20 00:17:00 +00:00
libssp Daily bump. 2023-01-08 00:16:59 +00:00
libstdc++-v3 libstdc++: Use lock-free type for __platform_wait_t 2023-01-12 11:01:09 +00:00
libvtv Daily bump. 2023-01-08 00:16:59 +00:00
lto-plugin Daily bump. 2022-11-24 00:17:47 +00:00
maintainer-scripts Daily bump. 2022-12-01 00:17:51 +00:00
zlib Daily bump. 2022-11-24 00:17:47 +00:00
.dir-locals.el
.gitattributes
.gitignore .gitignore: do not ignore config.h 2022-07-19 17:07:04 +03:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-01-11 00:17:56 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure configure: remove dependencies on gmp and mpfr when gdb is disabled 2023-01-06 09:36:52 +01:00
configure.ac configure: remove dependencies on gmp and mpfr when gdb is disabled 2023-01-06 09:36:52 +01:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Generic configury support for shared libs on VxWorks 2022-10-11 07:31:07 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Add myself as Rust front-end maintainer 2023-01-10 22:06:09 +00:00
Makefile.def configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.in configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.tpl Merge modula-2 front end onto gcc. 2022-12-14 17:43:08 +00:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.