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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrea Pinski <[email protected]>:

https://gcc.gnu.org/g:5d00ecd71b59b6c62748c014c6fa54180602192c

commit r17-4194-g5d00ecd71b59b6c62748c014c6fa54180602192c
Author: Andrea Pinski <[email protected]>
Date:   Sat Sep 12 15:33:26 2026 -0700

    match: Fix two_value for boundary conditions [PR127358]

    With r14-2299-g71b68cc559b5d3, the removal of prefering
    the unsigned type was removed.  This will cause wrong
    code with the boundary condition of the unsigned values
    of `INT_MAX` and `INT_MAX+1` in some cases.

    This adds back the prefering of unsigned types when
    the types precisions are the same.  Fixing the issue as
    we do the subtraction now in unsigned type; avoiding the
    undefined overflow.

    Pushed as obvious after a bootstrap/test on x86_64-linux-gnu.

            PR tree-optimization/127358

    gcc/ChangeLog:

            * match.pd (two_value cond): Prefer unsigned types.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/pr127358-1.c: New test.

    Signed-off-by: Andrea Pinski <[email protected]>

Reply via email to