]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa: Do not modify cgraph edges from thunk clones during inlining (PR116572)
authorMartin Jambor <mjambor@suse.cz>
Fri, 14 Mar 2025 15:07:01 +0000 (16:07 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 1 Apr 2025 09:33:22 +0000 (11:33 +0200)
commit5312a8f62a6bcae36f6aa40f88c8b58dfae7db21
tree3f5cbddbfb7d42d13e7ae702cf520f6a0278f8f1
parentb37d9e538123c71c6e3478ed902561131d1bf0be
ipa: Do not modify cgraph edges from thunk clones during inlining (PR116572)

In PR 116572 we hit an assert that a thunk which does not have a body
looks like it has one.  It does not, but the call_stmt of its outgoing
edge points to a statement, which should not.  In fact it has several
outgoing call graph edges, which cannot be.  The problem is that the
code updating the edges to reflect inlining into the master clone (an
ex-thunk, unlike the clone, which is still an unexpanded thunk) is
being updated during inling into the master clone.  This patch simply
makes the code to skip unexpanded thunk clones.

gcc/ChangeLog:

2025-03-13  Martin Jambor  <mjambor@suse.cz>

PR ipa/116572
* cgraph.cc (cgraph_update_edges_for_call_stmt): Do not update
edges of clones that are unexpanded thunk.  Assert that the node
passed as the parameter is not an unexpanded thunk.

gcc/testsuite/ChangeLog:

2025-03-13  Martin Jambor  <mjambor@suse.cz>

PR ipa/116572
* g++.dg/ipa/pr116572.C: New test.

(cherry picked from commit 075ec330307c5b1fe5ed166a633c718c06b01437)
gcc/cgraph.cc
gcc/testsuite/g++.dg/ipa/pr116572.C [new file with mode: 0644]