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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Richard Biener
<[email protected]>:

https://gcc.gnu.org/g:01b59a948f8240f81b61c42de13362c2a172f72e

commit r14-12291-g01b59a948f8240f81b61c42de13362c2a172f72e
Author: Andrew Pinski <[email protected]>
Date:   Thu Sep 19 13:50:14 2024 -0700

    match: Fix `a != 0 ? a * b : 0` patterns for things that trap [PR116772]

    For generic, `a != 0 ? a * b : 0` would match where `b` would be an
expression
    which trap (in the case of the testcase, it was an integer division but it
could be any).

    This adds a new helper function, expr_no_side_effects_p which tests if
there is no side effects
    and the expression is not trapping which might be used in other locations.

    Changes since v1:
    * v2: Add move check to helper function instead of inlining it.

            PR middle-end/116772

    gcc/ChangeLog:

            * generic-match-head.cc (expr_no_side_effects_p): New function
            * gimple-match-head.cc (expr_no_side_effects_p): New function

    gcc/testsuite/ChangeLog:

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

    Signed-off-by: Andrew Pinski <[email protected]>
    (cherry picked from commit 6c5543d3d9c4bbcd19f0ae2b7ed7e523c978a9a8)

Reply via email to