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

--- Comment #16 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Created attachment 63060
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63060&action=edit
GPT5 fix V2.

Reworked with GPT-5-Codex

Restored cgraph_edge::resolve_speculation in cgraph.cc to the documented
behaviour (resolve exactly one direct edge per call) and taught
cgraph_update_edges_for_call_stmt_node to walk the entire speculative bundle:
it now discards every non-matching speculative target, resolves the requested
one, and then clears any residue so inline no longer leaves orphaned direct
edges. Added devirt-multitarget-1.C, which forces a two-target speculation
through inlining and used to trip the verifier; it now checks that the devirt
dump reports two speculative targets and that the inline dump records the
speculation being resolved. Please rerun the g++ IPA test (e.g. make check-g++
RUNTESTFLAGS="ipa.exp=devirt-multitarget-1.C") to confirm.

The unit test doesn't work, but ICE in the PR is also fixed by the V2 patch.

Reply via email to