https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96059
Bug ID: 96059 Summary: ICE: in remove_unreachable_nodes, at ipa.c:575 with -fdevirtualize-at-ltrans Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: krzysztof.a.nowicki+gcc at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- When building the ktexteditor-5.71 from the KDE Frameworks with LTO enabled I'm seeing an ICE when linking libKF5TextEditor.so: during IPA pass: inline lto1: internal compiler error: in remove_unreachable_nodes, at ipa.c:575 0xa7e802 symbol_table::remove_unreachable_nodes(_IO_FILE*) /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa.c:575 0x19cb14f ipa_inline /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa-inline.c:2696 0x19cb702 execute /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa-inline.c:3091 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. GDB backtrace: #0 internal_error (gmsgid=gmsgid@entry=0x233d39a "in %s, at %s:%d") at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/diagnostic.c:1706 #1 0x0000000001b09d9a in fancy_abort (file=file@entry=0x1c07468 "/var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa.c", line=line@entry=575, function=function@entry=0x1c073fc "remove_unreachable_nodes") at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/diagnostic.c:1778 #2 0x0000000000a7e803 in symbol_table::remove_unreachable_nodes (this=0x7ffff6e8d100, file=0x0) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa.c:577 #3 0x00000000019cb150 in ipa_inline () at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa-inline.c:2696 #4 0x00000000019cb703 in (anonymous namespace)::pass_ipa_inline::execute (this=<optimized out>) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/ipa-inline.c:3091 #5 0x0000000000c047a3 in execute_one_pass (pass=pass@entry=0x3edc4a0) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/passes.c:2502 #6 0x0000000000c06052 in execute_ipa_pass_list (pass=0x3edc4a0) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/passes.c:2929 #7 0x00000000006442ac in do_whole_program_analysis () at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/context.h:48 #8 0x00000000006445f7 in lto_main () at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/lto/lto.c:637 #9 0x0000000000d1844d in compile_file () at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/toplev.c:458 #10 0x0000000000d1b891 in do_compile () at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/toplev.c:2277 #11 0x0000000000d1c1fd in toplev::main (this=this@entry=0x7fffffffd7f6, argc=<optimized out>, argc@entry=36, argv=<optimized out>, argv@entry=0x7fffffffd8f8) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/toplev.c:2416 #12 0x0000000001ae9eeb in main (argc=36, argv=0x7fffffffd8f8) at /var/tmp/portage/sys-devel/gcc-10.1.0-r1/work/gcc-10.1.0/gcc/main.c:39 CXXFLAGS: -O2 -pipe -march=skylake -flto=3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition The ICE goes away after removing the -fdevirtualize-at-ltrans flag. The backtrace above was generated from Gentoo-patched version of GCC, but it's also reproducible with a vanilla version compiled directly from sources. This is a regression since GCC 10 (reproducible also with latest GCC 11 trunk), as GCC 9 compiles this package with the same CXXFLAGS without issues. I've bisected the regression to the following commit: commit 2bc2379be5c98d34ecbb347b2abf059aa6d94499 Author: Jan Hubicka <j...@suse.cz> Date: Mon Nov 4 20:39:52 2019 +0100 ipa-inline-transform.c: Include ipa-utils.h * ipa-inline-transform.c: Include ipa-utils.h (inline_call): Set thunk_expansion flag. * ipa-utils.h (thunk_expansion): Declare. * ipa-devirt.c (thunk_expansion): New global var. (devirt_node_removal_hook): Do not invalidate cache while doing thunk expansion. From-SVN: r277789 Maybe the "HACK alert" in the commit diff has something to do with it :)