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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Jambor
<jamb...@gcc.gnu.org>:

https://gcc.gnu.org/g:e72cfef362a98528bf3d199f127916c3dbef7727

commit r10-8079-ge72cfef362a98528bf3d199f127916c3dbef7727
Author: Martin Jambor <mjam...@suse.cz>
Date:   Thu Apr 30 17:59:00 2020 +0200

    ipa: Cgraph verification fix (PR 94856)

    PR 94856 is a call graph verifier error.  We have a method which (in
    the course of IPA-CP) loses its this pointer because it is unused and
    the pass then does not clone all the this adjusting thunks and just
    makes the calls go straight to the new clone - and then the verifier
    complains that the edge does not seem to point to a clone of what it
    used to.  This looked weird because the verifier actually has logic
    detecting this case but it turns out that it is confused by inliner
    body-saving mechanism which invents a new decl for the base function.

    Making the inlining body-saving mechanism to correctly set
    former_clone_of allows us to detect this case too.  Then we pass this
    particular round of verification but the subsequent one fails because
    we have inlined the function into its former thunk - which
    subsequently does not have any callees, but the verifier still access
    them and segfaults.  Therefore the patch also adds a test whether the
    a former hunk even has any call.

    2020-04-30  Martin Jambor  <mjam...@suse.cz>

            PR ipa/94856
            * cgraph.c (clone_of_p): Also consider thunks whih had their bodies
            saved by the inliner and thunks which had their call inlined.
            * ipa-inline-transform.c (save_inline_function_body): Fill in
            former_clone_of of new body holders.

            PR ipa/94856
            * g++.dg/ipa/pr94856.C: New test.

Reply via email to