[Bug lto/100010] [10/11/12/13 Regression] ICE in lto_output_node, at lto-cgraph.c:447 (-fdevirtualize-at-ltrans) since r6-6384-gceda2c69d5219719

yinyuefengyi at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 16 08:03:18 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100010

--- Comment #8 from Xionghu Luo (luoxhu at gcc dot gnu.org) <yinyuefengyi at gmail dot com> ---
At the ICE point, node->clone_of has value, but clone_of is NULL:

(gdb) p clone_of
$114 = (cgraph_node *) 0x0
(gdb) p node->clone_of
$115 = (cgraph_node *) 0x7ffff6664bb0
(gdb) pnode node->clone_of
_ZN12ErrorHandler8decorateERK6String/0 (decorate)
  Type: function
  Visibility: semantic_interposition virtual
  next sharing asm name: 0
  References:
  Referring:
  Availability: not_available
  Function flags:
  Called by:
  Calls:
(gdb) pnode node
_ZN12ErrorHandler8decorateERK6String/0 (decorate)
  Type: function definition analyzed
  Visibility: semantic_interposition virtual
  previous sharing asm name: 0
  References:
  Referring:
  Read from file: a-pr10010.o
  Function decorate/0 is inline copy in decorate/1
  Clone of _ZN12ErrorHandler8decorateERK6String/0
  Availability: local
  Unit id: 1
  Function flags: count:1073741824 (estimated locally) local
  Called by: _ZN20LandmarkErrorHandler8decorateERK6String/1 (inlined)
(1073741824 (estimated locally),1.00 per call)
  Calls: _ZN6StringD1Ev/37 (1073741824 (estimated locally),1.00 per call)
_ZN6StringC1Ec/38 (1073741824 (estimated loca
lly),1.00 per call) (can throw external)
   Polymorphic indirect call of type struct ErrorHandler token:0(1073741824
(estimated locally),1.00 per call) (can thr
ow external) of param:0 (vptr maybe changed) num speculative call targets: 0
    Outer type (dynamic):struct ErrorHandler (or a derived type) offset 0


This simple change could fix but not sure whether it is correct.

diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc
index 6d9c36ea8b6..44a33a2af23 100644
--- a/gcc/lto-cgraph.cc
+++ b/gcc/lto-cgraph.cc
@@ -448,7 +448,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct
cgraph_node *node,
   if (clone_of && !lto_symtab_encoder_encode_body_p (encoder,
ultimate_clone_of))
     clone_of = NULL;

-  if (tag == LTO_symtab_analyzed_node)
+  if (tag == LTO_symtab_analyzed_node && !flag_ltrans_devirtualize)
     gcc_assert (clone_of || !node->clone_of);
   if (!clone_of)
     streamer_write_hwi_stream (ob->main_stream, LCC_NOT_FOUND);


More information about the Gcc-bugs mailing list