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

2019-03-08 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #7 from Martin Jambor  ---
Author: jamborm
Date: Fri Mar  8 22:55:20 2019
New Revision: 269517

URL: https://gcc.gnu.org/viewcvs?rev=269517=gcc=rev
Log:
Relax cgraph_node::clone_of_p to also look through former clones

2019-03-08  Martin Jambor  

Backport from mainline
2019-03-07  Martin Jambor  

PR ipa/88235
* cgraph.h (cgraph_node): New inline method former_thunk_p.
* cgraph.c (cgraph_node::dump): Dump a note if node is a former thunk.
(clone_of_p): Treat expanded thunks like thunks, be optimistic if they
have multiple callees.  At the end check if declarations match as
opposed to cgraph_nodes.

testsuite/
* g++.dg/ipa/pr88235.C: New test.


Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/ipa/pr88235.C
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/cgraph.c
branches/gcc-8-branch/gcc/cgraph.h
branches/gcc-8-branch/gcc/testsuite/ChangeLog

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

2019-03-07 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #6 from Martin Jambor  ---
Author: jamborm
Date: Thu Mar  7 16:03:34 2019
New Revision: 269462

URL: https://gcc.gnu.org/viewcvs?rev=269462=gcc=rev
Log:
Relax cgraph_node::clone_of_p to also look through former clones

2019-03-07  Martin Jambor  

PR ipa/88235
* cgraph.h (cgraph_node): New inline method former_thunk_p.
* cgraph.c (cgraph_node::dump): Dump a note if node is a former thunk.
(clone_of_p): Treat expanded thunks like thunks, be optimistic if they
have multiple callees.  At the end check if declarations match as
opposed to cgraph_nodes.

testsuite/
* g++.dg/ipa/pr88235.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/ipa/pr88235.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.c
trunk/gcc/cgraph.h
trunk/gcc/testsuite/ChangeLog

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

2019-03-06 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #5 from Martin Jambor  ---
I have proposed such patch on the mailing list:

https://gcc.gnu.org/ml/gcc-patches/2019-03/msg00262.html

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

2019-02-28 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #4 from Jan Hubicka  ---
I think you can add cgraph predicate
former_thunk_p which tests that

return !thunk_p && (thunk_info.fixed_offset || virtual_offset_p ||
indirect_offset)

Every thunk should set one of those (it may be good to also add sanity check
that whenever thunk_p the second part of condition suceeds).
This way you don't need to change all uses of thunk_p and patch won't break LTO
streaming once backported to gcc8.

Honza

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

2019-02-27 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #3 from Martin Jambor  ---
Created attachment 45841
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45841=edit
Heavy handed fix

This patch fixes the verification because it stores to cgraph_node
information that the node is an expanded thunk.  It is a fairly huge
change just to make a verifier shut up, but I cannot think of another
way and I always disliked the node->thunk.thunk_p testa and wanted to
replace them with node->thunk_p () call, so this is a good excuse.
Not sure if we want it for GCC 9 though (if at all, of course).

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

2019-02-27 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

--- Comment #2 from Martin Jambor  ---
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  0x01a53ace in inline_small_functions () at
/home/mjambor/gcc/icln/src/gcc/ipa-inline.c:2073
  2073  inline_call (edge, true, _indirect_edges,
_size, true);
  (gdb) p edge
  $26 =  *.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 = 

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)
;

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

2018-12-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|9.0 |7.5

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

2018-11-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88235

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-11-28
 CC||jamborm at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org
Summary|[9 Regression] ICE: |[7/8/9 Regression] ICE:
   |verify_cgraph_node failed   |verify_cgraph_node failed
   |(error: edge points to  |(error: edge points to
   |wrong declaration)  |wrong declaration)
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, started with r236274.