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

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

https://gcc.gnu.org/g:81fc567321e14ee14f356d4f3b5df518ebe6a5c1

commit r17-6812-g81fc567321e14ee14f356d4f3b5df518ebe6a5c1
Author: Dominic P <[email protected]>
Date:   Sat Nov 28 10:54:15 2026 +0000

    match.pd: Keep a possibly trapping remainder in X % Y < Y [PR125737]

    X % Y < Y -> Y >= 0 and X % Y >= Y -> Y < 0 (r17-1953, PR125737) drop
    the remainder even when Y might be zero and non-call exceptions are
    enabled, and also for an explicit zero divisor.  Use the same
    condition as the (X % Y) ==/!= X and (X / Y) ==/!= 0 folds (r17-3016).

    Assisted-by: Claude Opus 5.5 (Anthropic)
    Signed-off-by: Dominic P <[email protected]>

    gcc/ChangeLog:

            PR tree-optimization/125737
            * match.pd (X % Y < Y, X % Y >= Y): Preserve a possible
            zero-divisor exception.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/modcmp-2.c: New test.
            * gcc.dg/tree-ssa/modcmp-noncall-2.c: New test.

Reply via email to