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

--- 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:366b7772dd5424bc2b09c0796395d63d22710939

commit r17-2803-g366b7772dd5424bc2b09c0796395d63d22710939
Author: Andrea Pinski <[email protected]>
Date:   Wed Jul 29 16:12:42 2026 -0700

    match: Fix up expr_no_side_effects_p call for `(a != 0) ? (a / b) : 0`
pattern [PR126470]

    r15-3870-g6c5543d3d9c4bb introduced a fix for this pattern
    to use expr_no_side_effects_p but I was testing the wrong
    operand here which allowed b to become unconditional even
    if that expression traps.

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

            PR tree-optimization/126470

    gcc/ChangeLog:

            * match.pd (`(a != 0) ? (a / b) : 0`): Fix argument
            to expr_no_side_effects_p.

    gcc/testsuite/ChangeLog:

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

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

Reply via email to