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

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

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

commit r13-5681-ge8109bd87766be88e83fe88a44433dae16358a02
Author: Martin Jambor <mjam...@suse.cz>
Date:   Fri Feb 3 13:28:24 2023 +0100

    ipa: Avoid invalid gimple when IPA-CP and IPA-SRA disagree on types
(108384)

    When the compiled program contains type mismatches between callers and
    callees when it comes to a parameter, IPA-CP can try to propagate one
    constant from callers while IPA-SRA may try to split a parameter
    expecting a value of a different size on the same offset.  This then
    currently leads to creation of a VIEW_CONVERT_EXPR with mismatching
    type sizes of LHS and RHS which is correctly flagged by the GIMPLE
    verifier as invalid.

    It seems that the best course of action is to try and avoid the
    situation altogether and so this patch adds a check to IPA-SRA that
    peeks into the result of IPA-CP and when it sees a value on the same
    offset but with a mismatching size, it just decides to leave that
    particular parameter be.

    gcc/ChangeLog:

    2023-02-02  Martin Jambor  <mjam...@suse.cz>

            PR ipa/108384
            * ipa-sra.cc (push_param_adjustments_for_index): Remove a size
check
            when comparing to an IPA-CP value.
            (dump_list_of_param_indices): New function.
            (adjust_parameter_descriptions): Check for mismatching IPA-CP
values.
            Dump removed candidates using dump_list_of_param_indices.
            * ipa-param-manipulation.cc
            (ipa_param_body_adjustments::modify_expression): Add assert
checking
            sizes of a VIEW_CONVERT_EXPR will match.
            (ipa_param_body_adjustments::modify_assignment): Likewise.

    gcc/testsuite/ChangeLog:

    2023-02-02  Martin Jambor  <mjam...@suse.cz>

            PR ipa/108384
            * gcc.dg/ipa/pr108384.c: New test.

Reply via email to