https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121588
Peter Frost <mail at pfrost dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mail at pfrost dot me
--- Comment #10 from Peter Frost <mail at pfrost dot me> ---
I think I've managed to trigger this bug as well because of a mistake in my
makefile that compiled some files with `-flto` and some without. I get
essentially the same backtrace, although my GCC has debugging symbols so you
can see the source:
lto1: internal compiler error: Segmentation fault
0x19d69cf internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0xbf07df crash_signal
../../gcc/gcc/toplev.cc:322
0xa6ea38 lto_get_decl_name_mapping(lto_file_decl_data*, char const*)
../../gcc/gcc/lto-section-in.cc:369
0x772aa1 cgraph_node::get_untransformed_body()
../../gcc/gcc/cgraph.cc:4082
0x18acf27 ipa_icf::sem_function::init(ipa_icf_gimple::func_checker*)
../../gcc/gcc/ipa-icf.cc:1361
0x18af743 ipa_icf::sem_item_optimizer::parse_nonsingleton_classes()
../../gcc/gcc/ipa-icf.cc:2723
0x18b7a52 ipa_icf::sem_item_optimizer::execute()
../../gcc/gcc/ipa-icf.cc:2497
0x18b9286 ipa_icf_driver
../../gcc/gcc/ipa-icf.cc:3668
0x18b9286 ipa_icf::pass_ipa_icf::execute(function*)
../../gcc/gcc/ipa-icf.cc:3715
Seems to suggest a NULL dereference of decl_data in lto_get_decl_name_mapping,
which I think means lto_file_data is NULL in this case.
Looking around in other files, most functions seen to check this variable for
NULL. So it feels like maybe a null check should be added around here, and do
*something* to handle it.
arm-none-eabi-gcc 15.2.0, compiled with this script:
https://gist.github.com/badcf00d/2f6054441375d9c94896aaa8e878ab4f
Same crash happens on 15.1 although I didn't try older than that.