https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122174
Bug ID: 122174
Summary: gcc 14.3.0 crash in lto on arm9 with thumb1
Product: gcc
Version: 14.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: borkra at gmail dot com
Target Milestone: ---
Crash on uboot 2025.04 was introduced in gcc 14.3.0. Crash happens on arm9
build with thumb1 enabled on ipa pass.
[2025-10-04T02:12:11.152Z] LTO u-boot
[2025-10-04T02:12:11.152Z] during IPA pass: icf
[2025-10-04T02:12:11.152Z] lto1: internal compiler error: Segmentation fault
[2025-10-04T02:12:11.152Z] 0x18b793c diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x18b8c8c internal_error(char const*, ...)
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0xbbca03 crash_signal(int)
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0xa3a6ec
lto_get_decl_name_mapping(lto_file_decl_data*, char const*)
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x73fad9 cgraph_node::get_untransformed_body()
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x16a9359
ipa_icf::sem_function::init(ipa_icf_gimple::func_checker*)
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x16abd31
ipa_icf::sem_item_optimizer::parse_nonsingleton_classes()
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x16b4477 ipa_icf::sem_item_optimizer::execute()
[2025-10-04T02:12:11.152Z] ???:0
[2025-10-04T02:12:11.152Z] 0x16b5e4a ipa_icf::pass_ipa_icf::execute(function*)
[2025-10-04T02:12:11.152Z] ???:0
The crash caused by the following commit, reverting it resolves the crash.
>From e3290933ead698742f59e4abc4da694e73191203 Mon Sep 17 00:00:00 2001
From: Richard Biener <[email protected]>
Date: Fri, 28 Feb 2025 14:09:29 +0100
Subject: [PATCH] lto/91299 - weak definition inlined with LTO
The following fixes a thinko in the handling of interposed weak
definitions which confused the interposition check in
get_availability by setting DECL_EXTERNAL too early.
PR lto/91299
gcc/lto/
* lto-symtab.cc (lto_symtab_merge_symbols): Set DECL_EXTERNAL
only after calling get_availability.
gcc/testsuite/
* gcc.dg/lto/pr91299_0.c: New testcase.
* gcc.dg/lto/pr91299_1.c: Likewise.
(cherry picked from commit bc34db5b12e008f6ec4fdf4ebd22263c8617e5e3)