https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129119

            Bug ID: 129119
           Summary: internal compiler error in
                    aarch64_function_arg_alignment
           Product: gcc
           Version: 16.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thierry at lelegard dot fr
  Target Milestone: ---

Created attachment 66318
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66318&action=edit
Preprocessed source

- GCC version: 16.2.1
- Operating system: Fedora 45
- Architecture: aarch64 (Apple M3 CPU)

When compiling the short source code below on Arm64 systems, GCC aborts during
RTL pass "expand" with "internal compiler error: in
aarch64_function_arg_alignment".

Also seen with GCC 15.3.0 on Ubuntu 26.10 (other VM on same hardware).

Not seen on previous GCC versions or on other architectures.


Demonstration:
------------------------------------------------------------
$ gcc -c test.cpp
during RTL pass: expand
In file included from test.cpp:1:
test.cpp: In function ‘short unsigned int f(const void*)’:
test.cpp:5:12: internal compiler error: in aarch64_function_arg_alignment, at
config/aarch64/aarch64.cc:7494
    5 |     return bswap_16(*(static_cast<const unaligned_int16_t*>(p)));
      |            ^~~~~~~~
/usr/libexec/gcc/aarch64-redhat-linux/16/cc1plus -quiet -D_GNU_SOURCE test.cpp
-quiet -dumpbase test.cpp -dumpbase-ext .cpp -mlittle-endian -mabi=lp64 -o
/tmp/ccnjPxsj.s
Please submit a full bug report, with preprocessed source.
See <https://bugzilla.redhat.com/> for instructions.
Preprocessed source stored into /tmp/ccbGh06V.out file, please attach this to
your bugreport.
------------------------------------------------------------

File /tmp/ccbGh06V.out is attached to this report.


Source code:
------------------------------------------------------------
#include <byteswap.h>
using unaligned_int16_t = unsigned short __attribute__((aligned(1),
may_alias));
unsigned short f(const void* p)
{
    return bswap_16(*(static_cast<const unaligned_int16_t*>(p)));
}
------------------------------------------------------------

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/16/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,cobol,algol68,lto
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugzilla.redhat.com/ --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only --enable-plugin
--enable-initfini-array --enable-libstdcxx-backtrace
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo
--with-isl=/builddir/build/BUILD/gcc-16.2.1-build/gcc-16.2.1-20261029/obj-aarch64-redhat-linux/isl-install
--enable-gnu-indirect-function --enable-multilib --with-linker-hash-style=gnu
--build=aarch64-redhat-linux --with-build-config=bootstrap-lto
--enable-link-serialization=1 --disable-libssp --disable-libquadmath
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.2.1 20261029 (Red Hat 16.2.1-3) (GCC)

Reply via email to