[Bug ipa/88235] [7/8/9 Regression] ICE: verify_cgraph_node failed (error: edge points to wrong declaration)

jamborm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 27 14:10:00 GMT 2019


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

--- Comment #2 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have looked at this a bit more and the problem is that thunk
inlining expands a thunk which then makes the clone_of_p() part of
cgraph_edge::verify_corresponds_to_fndecl() fail.

I must say that I found the inlining decision that does the expansion
a bit unexpected:

  #2  0x0000000001a53ace in inline_small_functions () at
/home/mjambor/gcc/icln/src/gcc/ipa-inline.c:2073
  2073              inline_call (edge, true, &new_indirect_edges,
&overall_size, true);
  (gdb) p edge
  $26 = <cgraph_edge _ZThn8_N8ItemView5eventEv/14 -> *.LTHUNK0/13>

where _ZThn8_N8ItemView5eventEv/14 is a real thunk and *.LTHUNK0/13 is
an alias to the real method.  The thing is that the thunk has no
(known) callers:

  (gdb) p edge->caller->callers
  $29 = <cgraph_edge NULL>

Is that intentional?  Do we want to inline functions into their thunks
even that thunk is not itself inlined into anything?

Also, the code in clone_of_p assumes that each thunk has one callee,
which seems to be in start contrast with the comment and code in
inline_call():

  /* When thunk is instrumented we may have multiple callees.  */
  for (e = to->callees; e && e->callee != target; e = e->next_callee)
    ;


More information about the Gcc-bugs mailing list