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

--- Comment #10 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:0413057e561e91f4228d886b40a2045e0656294d

commit r16-8775-g0413057e561e91f4228d886b40a2045e0656294d
Author: Jakub Jelinek <[email protected]>
Date:   Tue Apr 21 11:53:52 2026 +0200

    bitintlower: Padding bit fixes, part 4 [PR123635]

    As the following testcase shows, not clearing the padding bits after
    signed MULT_EXPR (or signed division) is reasonable when overflow actually
is
    undefined behavior because then anything can happen.  But when it is not
    undefined behavior due to -fwrapv, we need to clear the padding bits
    on targets which chose that behavior.  It isn't only signed MULT_EXPR,
    but also division because smallest negative / -1 overflows and in that
    case the padding bits aren't correct for bitint_extended targets either.

    2026-04-21  Jakub Jelinek  <[email protected]>

            PR middle-end/123635
            * gimple-lower-bitint.cc (bitint_large_huge::lower_muldiv_stmt):
            Extend the padding bits not just for unsigned MULT_EXPR but for any
            TYPE_OVERFLOW_WRAPS MULT_EXPR and signed TYPE_OVERFLOW_WRAPS
division.

            * gcc.dg/torture/bitint-90.c: New test.

    Reviewed-by: Richard Biener <[email protected]>

Reply via email to