Bug 93347 - [10 Regression] ICE: verify_cgraph_node failed (error: calls_comdat_local is set outside of a comdat group)
Summary: [10 Regression] ICE: verify_cgraph_node failed (error: calls_comdat_local is ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 10.0
: P1 normal
Target Milestone: 10.0
Assignee: Jan Hubicka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-01-21 05:02 UTC by Arseny Solokha
Modified: 2020-03-20 21:07 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 9.2.0
Known to fail: 10.0
Last reconfirmed: 2020-01-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2020-01-21 05:02:12 UTC
g++-10.0.0-alpha20200119 snapshot (g:3684bbb022cd75da55e1457673f269980aa12cdf) ICEs when compiling the following testcase, reduced from clang/testsuite/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp from the clang 9.0.1 test suite, w/ -O3 --param early-inlining-insns=3 --param ipa-cp-eval-threshold=100:

% g++-10.0.0-alpha20200119 -O3 --param early-inlining-insns=3 --param ipa-cp-eval-threshold=100 -c vk0cmj0d.cpp
vk0cmj0d.cpp:26:1: error: calls_comdat_local is set outside of a comdat group
   26 | }
      | ^
_ZTch0_h4_N2dm2tvEv/2 (virtual nx* dm::_ZTch0_h4_N2dm2tvEv()) @0x7f526ae372d0
  Type: function
  Body removed by symtab_remove_unreachable_nodes
  Visibility: externally_visible public weak comdat comdat_group:_ZN2dm2tvEv one_only section:.text._ZN2dm2tvEv (implicit_section) virtual artificial
  References: 
  Referring: 
  Availability: not_available
  Function flags: count:10000 (estimated locally) calls_comdat_local indirect_call_target
  Former thunk fixed offset 4 virtual value 0 indirect_offset 0 has virtual offset 0
  Called by: 
  Calls: 
during IPA pass: inline
vk0cmj0d.cpp:26:1: internal compiler error: verify_cgraph_node failed
0xb7c71e cgraph_node::verify_node()
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/cgraph.c:3717
0xb6fc94 symtab_node::verify()
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/symtab.c:1300
0xb70dd2 symtab_node::verify_symtab_nodes()
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/symtab.c:1320
0xdef5bb symtab_node::checking_verify_symtab_nodes()
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/cgraph.h:667
0xdef5bb symbol_table::remove_unreachable_nodes(_IO_FILE*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/ipa.c:673
0x1947845 ipa_inline
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/ipa-inline.c:2694
0x1947845 execute
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20200119/work/gcc-10-20200119/gcc/ipa-inline.c:3089
Comment 1 Martin Liška 2020-01-21 08:51:15 UTC
Confirmed, started with r10-5142-g21cd8589291a1b415106740acd56509e0143356d.
Comment 2 GCC Commits 2020-03-20 21:06:58 UTC
The master branch has been updated by Jan Hubicka <hubicka@gcc.gnu.org>:

https://gcc.gnu.org/g:72b3bc895f023bf451357659cfe96c966945bdf9

commit r10-7306-g72b3bc895f023bf451357659cfe96c966945bdf9
Author: Jan Hubicka <jh@suse.cz>
Date:   Fri Mar 20 22:06:24 2020 +0100

    Fix verifier ICE on wrong comdat local flag [PR93347]
    
    gcc/ChangeLog:
    
    2020-03-20  Jan Hubicka  <hubicka@ucw.cz>
    
            PR ipa/93347
            * cgraph.c (symbol_table::create_edge): Update calls_comdat_local flag.
            (cgraph_edge::redirect_callee): Move here; likewise.
            (cgraph_node::remove_callees): Update calls_comdat_local flag.
            (cgraph_node::verify_node): Verify that calls_comdat_local flag match
            reality.
            (cgraph_node::check_calls_comdat_local_p): New member function.
            * cgraph.h (cgraph_node::check_calls_comdat_local_p): Declare.
            (cgraph_edge::redirect_callee): Move offline.
            * ipa-fnsummary.c (compute_fn_summary): Do not compute
            calls_comdat_local flag here.
            * ipa-inline-transform.c (inline_call): Fix updating of
            calls_comdat_local flag.
            * ipa-split.c (split_function): Use true instead of 1 to set the flag.
            * symtab.c (symtab_node::add_to_same_comdat_group): Update
            calls_comdat_local flag.
    
    gcc/testsuite/ChangeLog:
    
    2020-03-20  Jan Hubicka  <hubicka@ucw.cz>
    
            * g++.dg/torture/pr93347.C: New test.
Comment 3 Jan Hubicka 2020-03-20 21:07:43 UTC
Fixed. I noticed that some of the tests are not devirtualized, so we may move that into new PR.