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

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

https://gcc.gnu.org/g:8faf384703ccbc2cde926c9d8acf2842db1b1cea

commit r16-9257-g8faf384703ccbc2cde926c9d8acf2842db1b1cea
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.

    (cherry picked from commit 281b8d054f6b98386f3ecd8a1e82a3374dd9d674)

Reply via email to