https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121588
Bug ID: 121588 Summary: gcc 15.2.0 crashes when building u-boot 2022.07 with LTO Product: gcc Version: 15.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: faber at faberman dot de Target Milestone: --- while building u-boot v2022.07 for a set of different architectures, one of them (arm(hf) for am335x) crashed: ----------------------snip------------------------ AR spl/lib/built-in.o KSL spl/keep-syms-lto.c KSLCC spl/keep-syms-lto.o LTO spl/u-boot-spl during IPA pass: icf lto1: internal compiler error: Segmentation fault 0x60c0cdd3fffa diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x60c0cdd51bc6 internal_error(char const*, ...) ???:0 0x60c0ccd2e229 lto_get_decl_name_mapping(lto_file_decl_data*, char const*) ???:0 0x60c0cc9fd149 cgraph_node::get_untransformed_body() ???:0 0x60c0cdc0feb9 ipa_icf::sem_function::init(ipa_icf_gimple::func_checker*) ???:0 0x60c0cdc12ad1 ipa_icf::sem_item_optimizer::parse_nonsingleton_classes() ???:0 0x60c0cdc1bccc ipa_icf::sem_item_optimizer::execute() ???:0 0x60c0cdc1d11a ipa_icf::pass_ipa_icf::execute(function*) ???:0 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: /usr/sbin/arm-linux-gnueabi-gcc returned 1 exit status compilation terminated. ----------------------snip------------------------ gcc is 15.2.0 release: ----------------------snip------------------------ $ arm-linux-gnueabi-gcc --version arm-linux-gnueabi-gcc (Gentoo Hardened 15.2.0 p5) 15.2.0 ----------------------snip------------------------ Weirdly all other targets, including other arm- and armhf-targets, LTO and non-LTO, built successfully. The target which crashed builds fine without LTO (disabling it is our current workaround). We could reproduce the behaviour with a vanilla v2022.07 u-boot: ----------------------snip-------------------------- $ git clone https://github.com/u-boot/u-boot.git $ cd u-boot $ git checkout tags/v2022.07 $ ARCH=arm CROSS_COMPILE=/usr/sbin/arm-linux-gnueabi- make am335x_evm_defconfig ----------------------snip-------------------------- This non-LTO config should build, now add `CONFIG_LTO=y` to the .config file, clean and build again: Segfault.