Go to file
Richard Sandiford 14814e2016 aarch64: Fix -fpack-struct + <arm_neon.h> [PR103147]
This PR is about -fpack-struct causing a crash when <arm_neon.h>
is included.  The new register_tuple_type code was expecting a
normal unpacked structure layout instead of a packed one.

For SVE we got around this by temporarily suppressing -fpack-struct,
so that the tuple types always have their normal ABI.  However:

(a) The SVE ACLE tuple types are defined to be abstract.  The fact
    that GCC uses structures is an internal implementation detail.

(b) In contrast, the ACLE explicitly defines the Advanced SIMD
    tuple types to be particular structures.

(c) Clang and previous versions of GCC are consistent in applying
    -fpack-struct to these tuple structures.

This patch therefore honours -fpack-struct and -fpack-struct=.  It also
adds tests for some other combinations, such as -mgeneral-regs-only and
-fpack-struct -mstrict-align.

gcc/
	PR target/103147
	* config/aarch64/aarch64-protos.h (aarch64_simd_switcher): New class.
	* config/aarch64/aarch64-sve-builtins.h (sve_switcher): Inherit
	from aarch64_simd_switcher.
	* config/aarch64/aarch64-builtins.cc (aarch64_simd_tuple_modes):
	New variable.
	(aarch64_lookup_simd_builtin_type): Use it instead of TYPE_MODE.
	(register_tuple_type): Add more asserts.  Expect the alignment
	of the structure to be subject to flag_pack_struct and
	maximum_field_alignment.  Set aarch64_simd_tuple_modes.
	(aarch64_simd_switcher::aarch64_simd_switcher): New function.
	(aarch64_simd_switcher::~aarch64_simd_switcher): Likewise.
	(handle_arm_neon_h): Hold an aarch64_simd_switcher throughout.
	(aarch64_general_init_builtins): Hold an aarch64_simd_switcher
	while calling aarch64_init_simd_builtins.
	* config/aarch64/aarch64-sve-builtins.cc (sve_switcher::sve_switcher)
	(sve_switcher::~sve_switcher): Remove code now performed by
	aarch64_simd_switcher.

gcc/testsuite/
	PR target/103147
	* gcc.target/aarch64/pr103147-1.c: New test.
	* gcc.target/aarch64/pr103147-2.c: Likewise.
	* gcc.target/aarch64/pr103147-3.c: Likewise.
	* gcc.target/aarch64/pr103147-4.c: Likewise.
	* gcc.target/aarch64/pr103147-5.c: Likewise.
	* gcc.target/aarch64/pr103147-6.c: Likewise.
	* gcc.target/aarch64/pr103147-7.c: Likewise.
	* gcc.target/aarch64/pr103147-8.c: Likewise.
	* gcc.target/aarch64/pr103147-9.c: Likewise.
	* gcc.target/aarch64/pr103147-10.c: Likewise.
	* g++.target/aarch64/pr103147-1.C: Likewise.
	* g++.target/aarch64/pr103147-2.C: Likewise.
	* g++.target/aarch64/pr103147-3.C: Likewise.
	* g++.target/aarch64/pr103147-4.C: Likewise.
	* g++.target/aarch64/pr103147-5.C: Likewise.
	* g++.target/aarch64/pr103147-6.C: Likewise.
	* g++.target/aarch64/pr103147-7.C: Likewise.
	* g++.target/aarch64/pr103147-8.C: Likewise.
	* g++.target/aarch64/pr103147-9.C: Likewise.
	* g++.target/aarch64/pr103147-10.C: Likewise.
2022-04-05 17:31:35 +01:00
c++tools Daily bump. 2022-03-19 00:16:22 +00:00
config Daily bump. 2022-03-30 00:16:49 +00:00
contrib Daily bump. 2022-04-04 08:00:40 +00:00
fixincludes Daily bump. 2022-02-28 00:16:17 +00:00
gcc aarch64: Fix -fpack-struct + <arm_neon.h> [PR103147] 2022-04-05 17:31:35 +01:00
gnattools
gotools Daily bump. 2022-02-14 00:16:23 +00:00
include Daily bump. 2022-03-20 00:16:30 +00:00
INSTALL
intl
libada
libatomic Daily bump. 2022-03-25 00:17:18 +00:00
libbacktrace Daily bump. 2022-02-18 00:16:39 +00:00
libcc1
libcody Daily bump. 2022-03-19 00:16:22 +00:00
libcpp Daily bump. 2022-03-05 00:16:31 +00:00
libdecnumber
libffi
libgcc Daily bump. 2022-03-30 00:16:49 +00:00
libgfortran Daily bump. 2022-01-27 00:16:29 +00:00
libgo runtime: support PPC32 MUSL register access 2022-03-31 13:26:13 -07:00
libgomp OpenMP: Fix nested use_device_ptr 2022-04-05 08:31:34 -07:00
libiberty Daily bump. 2022-03-20 00:16:30 +00:00
libitm Daily bump. 2022-02-04 00:16:24 +00:00
libobjc
liboffloadmic
libphobos Daily bump. 2022-04-04 08:00:40 +00:00
libquadmath
libsanitizer Daily bump. 2022-03-15 00:16:49 +00:00
libssp
libstdc++-v3 Daily bump. 2022-04-04 08:00:40 +00:00
libvtv
lto-plugin Daily bump. 2022-03-23 00:16:45 +00:00
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2022-04-04 08:00:40 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure LoongArch Port: Regenerate configure 2022-03-29 17:43:32 +08:00
configure.ac LoongArch Port: Regenerate configure 2022-03-29 17:43:32 +08:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address 2022-04-01 12:26:00 +08:00
Makefile.def toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.in toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.tpl
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.