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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:865d60ab4edbdb10d13000af81f9168fd3816a86

commit r13-8837-g865d60ab4edbdb10d13000af81f9168fd3816a86
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jun 4 15:49:41 2024 +0200

    fold-const: Fix up CLZ handling in tree_call_nonnegative_warnv_p [PR115337]

    The function currently incorrectly assumes all the __builtin_clz* and .CLZ
    calls have non-negative result.  That is the case of the former which is UB
    on zero and has [0, prec-1] return value otherwise, and is the case of the
    single argument .CLZ as well (again, UB on zero), but for two argument
    .CLZ is the case only if the second argument is also nonnegative (or if we
    know the argument can't be zero, but let's do that just in the ranger
IMHO).

    The following patch does that.

    2024-06-04  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/115337
            * fold-const.cc (tree_call_nonnegative_warnv_p) <CASE_CFN_CLZ>:
            If fn is CFN_CLZ, use CLZ_DEFINED_VALUE_AT.

    (cherry picked from commit b82a816000791e7a286c7836b3a473ec0e2a577b)

Reply via email to