[Bug tree-optimization/125756] nonnegative < (typeof nonnegative)(nonnegative != 0) is false

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 15 17:14:32 GMT 2026


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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:86a6d4ff7844e54cb8e685b6ea0782ceca618888

commit r17-1572-g86a6d4ff7844e54cb8e685b6ea0782ceca618888
Author: Kael Andrew Franco <kaelfandrew@gmail.com>
Date:   Mon Jun 15 11:13:18 2026 -0600

    [PATCH] match: For nonnegative X, relax condition on X < (typeof X)(X != 0)
to false [PR125756]

    From 0d094722ecdb86aa8373134a36392c60e6bb2b69 Mon Sep 17 00:00:00 2001
    From: Kael Andrew Alonzo Franco <kaelfandrew@gmail.com>
    Date: Sat, 13 Jun 2026 08:56:34 -0400
    Subject: [PATCH] match: For nonnegative X, relax condition on X < (typeof
X)(X != 0) to false [PR125756]

    tree_expr_nonnegative_p covers both TYPE_UNSIGNED (type) or when X is known
to be nonnegative.

    Bootstrapped and tested on x86_64-pc-linux-gnu

            PR tree-optimization/125756

    gcc/ChangeLog:

            * match.pd: Use tree_expr_nonnegative_p for X < (typeof X)(X != 0)
to false.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr125756.c: New test.


More information about the Gcc-bugs mailing list