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

--- Comment #17 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:281b8d054f6b98386f3ecd8a1e82a3374dd9d674

commit r17-1660-g281b8d054f6b98386f3ecd8a1e82a3374dd9d674
Author: Martin Jambor <[email protected]>
Date:   Thu Jun 18 14:55:33 2026 +0200

    ipa-cp: Fix ipa-vr intersection in wrong type (PR124128)

    Function ipa_vr_intersect_with_arith_jfunc in ipa-cp.cc contains a
    check

      if (src_type == dst_type)

    which should have been

      if (operation_type == dst_type)

    which lead to an ICE in the ranger machinery as it tried to intersect
    a signed and an unsigned integer when compiling the testcases from
    PR124128.

    The condition itself is basically an early exit to avoid calling yet
    another ipa_vr_operation_and_type_effects to type-convert the value
    range when we already can simply compare the types and see we already
    have the righ thing.  A better place for it is however just before
    that conversion, where it can also avoid the call when dealing with
    the most simple of pass-through jump functions (and where it generally
    "makes more sense") so this is what the patch does.

    gcc/ChangeLog:

    2026-06-04  Martin Jambor  <[email protected]>

            PR ipa/124128
            * ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Move the check if
            the final type conversion needs to happen before the conversion.

    gcc/testsuite/ChangeLog:

    2026-06-04  Martin Jambor  <[email protected]>

            PR ipa/124128
            * gcc.dg/ipa/pr124128.c: New test.

Reply via email to