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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <[email protected]>:

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

commit r17-7181-gac8357f9f1289f6b5828b2eb81ced394646f4af3
Author: Adam W. Willis <[email protected]>
Date:   Wed Nov 18 10:15:38 2026 -0500

    ipa: Don't read the call statement of an indirect edge at WPA [PR128825]

    Since r17-6284-g610d42e09ff844 ("Fold ancestor and arithmetic aggregate
    jump functions after inlining"), update_jump_functions_after_inlining
    asks ipa_get_callee_param_type for a parameter type whenever it folds a
    constant into an ancestor jump function.  It does this for every outgoing
    edge of the inlined callee, including indirect ones.  Without a callee,
    ipa_get_callee_param_type takes the type from the edge's call statement,
    but at WPA the function bodies aren't loaded and call_stmt is NULL, so
    gimple_call_fntype dereferences NULL.

    Return NULL, as for a callee whose parameter types aren't known, when the
    edge has neither a callee nor a call statement.  The caller then folds the
    constant without checking it against a parameter type, as it already does
    for a callee without a prototype, and IPA-CP still checks the value
    against the parameter type of the eventual callee before using it.

    Assisted-by: LLM
    Signed-off-by: Adam W. Willis <[email protected]>

            PR ipa/128825

    gcc/ChangeLog:

            * ipa-prop.cc (ipa_get_callee_param_type): Return NULL for an
            edge that has neither a callee nor a call statement.

    gcc/testsuite/ChangeLog:

            * gcc.dg/lto/pr128825_0.c: New test.
            * gcc.dg/lto/pr128825_1.c: New test.

Reply via email to