https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128825
Bug ID: 128825
Summary: ICE when building ccache unittests with -O2 -flto
during IPA pass: inline
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: parona at protonmail dot com
Target Milestone: ---
Created attachment 66206
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66206&action=edit
Minimized reproducer
Fails with -O2 -flto but not with -O1 -flto. Older gcc work as well.
$ g++-17 -w -O2 -flto main.cpp
during IPA pass: inline
lto1: internal compiler error: Segmentation fault
0x55ef4b3c7484 internal_error(char const*, ...)
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/diagnostic-global-context.cc:787
0x55ef4ad1947a crash_signal
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/toplev.cc:325
0x7f5681847e2f ???
/usr/src/debug/sys-libs/glibc-2.44-r4/glibc-2.44/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x55ef4b9ac889 gimple_call_fntype(gcall const*)
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/gimple.h:3188
0x55ef4b9ac889 ipa_get_callee_param_type(cgraph_edge*, int)
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:2534
0x55ef4b7df506 update_jump_functions_after_inlining
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:4054
0x55ef4b7dd23c propagate_info_to_inlined_callees
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:5011
0x55ef4b7dd23c ipa_propagate_indirect_call_infos(cgraph_edge*,
vec<cgraph_edge*, va_heap, vl_ptr>*)
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:5184
0x55ef4b78bf49 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap,
vl_ptr>*, int*, bool, bool*)
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline-transform.cc:577
0x55ef4befe8de inline_small_functions
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:2441
0x55ef4befe8de ipa_inline
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:2923
0x55ef4befe8de execute
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:3446
/usr/libexec/gcc/x86_64-pc-linux-gnu/17/lto1 -quiet -dumpbase ./a.wpa
-mtls-dialect=gnu2 -mtune=generic -march=x86-64 -mtls-dialect=gnu2 -O2 -O2 -w
-fno-openmp -fno-openacc -fPIE -fcf-protection=full
-foffload-options=-l_GCC_stdc++ -foffload-options=-l_GCC_m
-fltrans-output-list=/tmp/ccp9z9ZE.ltrans.out -fwpa
-fresolution=/tmp/cc8T1x7o.res -flinker-output=pie
-foffload-options=-fno-stack-protector @/tmp/cc6e6p5Y
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: g++-17 returned 1 exit status
compilation terminated.
/usr/x86_64-pc-linux-gnu/binutils-bin/2.47/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Backtrace from gdb:
ipa_get_callee_param_type () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:2534
2534 : gimple_call_fntype (e->call_stmt));
(gdb) bt
#0 ipa_get_callee_param_type () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:2534
#1 0x0000555557199507 in update_jump_functions_after_inlining () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:4054
#2 0x000055555719723d in propagate_info_to_inlined_callees () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:5011
#3 ipa_propagate_indirect_call_infos () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-prop.cc:5184
#4 0x0000555557145f4a in inline_call () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline-transform.cc:577
#5 0x00005555578b88df in inline_small_functions () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:2441
#6 ipa_inline () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:2923
#7 execute () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/ipa-inline.cc:3446
#8 0x0000555556ee6d24 in execute_one_pass () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/passes.cc:2651
#9 0x000055555789a8f4 in execute_ipa_pass_list () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/passes.cc:3111
#10 0x0000555557881bff in do_whole_program_analysis () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/lto/lto.cc:558
#11 lto_main () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/lto/lto.cc:703
#12 0x000055555787bd8b in compile_file () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/toplev.cc:455
#13 0x000055555782e546 in do_compile () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/toplev.cc:2232
#14 toplev::main () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/toplev.cc:2400
#15 0x000055555782d2fd in main () at
/usr/src/debug/sys-devel/gcc-17.0.0_p20261115/gcc-17-20261115/gcc/main.cc:39
$ g++-17 -v
Using built-in specs.
COLLECT_GCC=g++-17
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/17/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-17.0.0_p20261115/work/gcc-17-20261115/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/17
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/17/python
--enable-libphobos
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,algol68,jit
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 17.0.0_p20261115 p22' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --enable-libada --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --with-tls=gnu2 --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp
--disable-libssp --enable-cet --disable-systemtap
--disable-valgrind-annotations --disable-valgrind-interop
--disable-vtable-verify --disable-libvtv --with-zstd --without-isl
--enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --enable-host-shared
--enable-linker-build-id --enable-linker-build-id --enable-linker-build-id
--enable-linker-build-id --with-build-config='bootstrap-O3 bootstrap-lto
bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261115 (experimental) (Gentoo 17.0.0_p20261115 p22)