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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<[email protected]>:

https://gcc.gnu.org/g:ba797c7ab43c8aa0d5eaf0fc72d8dd9d88c1631b

commit r16-10058-gba797c7ab43c8aa0d5eaf0fc72d8dd9d88c1631b
Author: Jakub Jelinek <[email protected]>
Date:   Thu Dec 3 11:17:27 2026 +0100

    ifcvt: Fix UB in noce_splat_to_const [PR129222]

    These two spots want to test if val (resp. ~val) is some
    power of 2 minus one, but because val has HOST_WIDE_INT type,
    does the 1 addition in that type and can trigger signed overflow.

    Fixed by using HOST_WIDE_INT_1U instead of 1.

    2026-12-03  Jakub Jelinek  <[email protected]>

            PR rtl-optimization/129222
            * ifcvt.cc (noce_try_sign_bit_splat): Add 1 in exact_log2
            operands in unsigned HOST_WIDE_INT type rather than
            HOST_WIDE_INT type.

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

    Reviewed-by: Richard Biener <[email protected]>
    (cherry picked from commit 50400a226fdc9e98542e809956cedd332f922832)

Reply via email to