https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106642
Bug ID: 106642
Summary: cc1 compiler hangs when cross-compiling ring_buffer.c
(from kernel/events) on Aarch64
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pivanov at hotmail dot com
Target Milestone: ---
Compiler hangs forever and consumes all available memory when cross-compiling
android kernel tree.
The file that it hangs on is kernel/events/ring_buffer.c
You may find the preprocessed ring_buffer.i attached.
Compiler version and flags (source code checked out @ commit 1c596391e):
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1c596391e150a6b0c55960c1c1cf1da76ea78230
------------------------------------------------------------------------
/storage/gcc-arm64/bin/aarch64-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/storage/gcc-arm64/bin/aarch64-elf-gcc
COLLECT_LTO_WRAPPER=/storage/gcc-arm64/bin/../libexec/gcc/aarch64-elf/13.0.0/lto-wrapper
Target: aarch64-elf
Configured with: ../gcc/configure --target=aarch64-elf CFLAGS='-flto
-flto-compression-level=10 -O3 -pipe -ffunction-sections -fdata-sections'
CXXFLAGS='-flto -flto-compression-level=10 -O3 -pipe -ffunction-sections
-fdata-sections' --prefix=/storage/gcc-arm64 --disable-decimal-float
--disable-gcov --disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libstdcxx-pch --disable-nls --disable-shared
--disable-docs --enable-default-ssp --enable-languages=c,c++
--enable-threads=posix --with-pkgversion='Eva GCC' --with-newlib --with-gnu-as
--with-gnu-ld --with-linker-hash-style=gnu --with-sysroot
--with-headers=/usr/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220816 (Bleeding Edge) (Eva GCC)
Command line used that hangs compiler:
----------------------------------------
/storage/gcc-arm64/bin/aarch64-elf-gcc -Wp,-MD,kernel/events/.ring_buffer.o.d
-nostdinc -isystem
/ext/gcc-arm64-gcc-master/bin/../lib/gcc/aarch64-elf/13.0.0/include
-I../arch/arm64/include -I./arch/arm64/include/generated -I../include
-I./include -I../arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi
-I../include/uapi -I./include/generated/uapi -include
../include/linux/kconfig.h -I../kernel/events -Ikernel/events -D__KERNEL__
-mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT=3 -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar
-Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE
-fno-gcse -mgeneral-regs-only -DCONFIG_AS_LSE=1 -DCONFIG_VDSO32=1
-fno-asynchronous-unwind-tables -fno-pic -mabi=lp64
-DCONFIG_ARCH_SUPPORTS_INT128 -DKASAN_SHADOW_SCALE_SHIFT=3 -O3
-mcpu=cortex-a76.cortex-a55+crypto+crc+lse+fp16+rcpc+rdma+dotprod
-mtune=cortex-a76.cortex-a55 -fgraphite-identity -floop-nest-optimize
-fno-semantic-interposition -fdevirtualize-at-ltrans -fipa-pta -fno-plt
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member
-Wno-attribute-alias -O3
-mcpu=cortex-a76.cortex-a55+crypto+crc+lse+fp16+rcpc+rdma+dotprod
-mtune=cortex-a76.cortex-a55 -fgraphite-identity -floop-nest-optimize
-fno-semantic-interposition -fdevirtualize-at-ltrans -fipa-pta -fno-plt
-fno-allow-store-data-races -DCC_HAVE_ASM_GOTO -fstack-protector-strong
-fno-delete-null-pointer-checks -Wno-unused-but-set-variable
-Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fno-var-tracking-assignments -ffunction-sections -fdata-sections
-Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation
-Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants
-fmerge-constants -fno-stack-check -Werror=implicit-int
-Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -fmacro-prefix-map=../= -fgcse-sm
-Wno-packed-not-aligned -DKBUILD_BASENAME='"ring_buffer"'
-DKBUILD_MODNAME='"ring_buffer"' -c -o kernel/events/ring_buffer.o
../kernel/events/ring_buffer.c
--------------------------------------------
The same command line hangs on the attached preprocessed file (ring_buffer.i)
so the bug should be fully reproducible.
I did try to alter options from the command line above but couldn't make it to
compile no matter what options have been removed.