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

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

https://gcc.gnu.org/g:50400a226fdc9e98542e809956cedd332f922832

commit r17-7069-g50400a226fdc9e98542e809956cedd332f922832
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_splat_to_const): 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]>

Reply via email to