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

--- 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:471ee3f3c98f9afffd61443b995c67f76e0e4b99

commit r17-3457-g471ee3f3c98f9afffd61443b995c67f76e0e4b99
Author: Manjunath Matti <[email protected]>
Date:   Thu Aug 20 08:51:55 2026 +0200

    bitintlower: Fix memmove source operand in finish_arith_overflow [PR126939]

    finish_arith_overflow builds a memmove call to shift the result of a
    double-width multiplication down inside the destination object, on
    big-endian targets where the computed value occupies more limbs than
    the destination.

    The destination argument correctly takes the address of OBJ, but SRC is
    a MEM_REF, that is a value of array type, and it is passed directly as
    memmove's second argument, which is a pointer.  Wrap it in
    build_fold_addr_expr so that the address is passed instead.  Since
    build_fold_addr_expr of a MEM_REF folds back to the pointer, no
    dereference is materialised.

    The affected code is guarded by bitint_big_endian, and is only reached
    for widths whose value needs more limbs than the destination object,
    that is huge _BitInt operands of __builtin_{add,sub,mul}_overflow, so
    it needs a big-endian target with _BitInt support to be exercised at
    all.  It is being hit now that _BitInt is being enabled for powerpc
    (PR117584).

    Existing coverage is sufficient: on powerpc64 big-endian this fixes
    gcc.dg/torture/bitint-93.c and bitint-94.c at -O0 and -O2, and
    gcc.dg/torture/bitint-32.c through bitint-37.c at -O0.  No new test is
    added.

    2026-08-20  Manjunath Matti  <[email protected]>

            PR middle-end/126939
            * gimple-lower-bitint.cc
(bitint_large_huge::finish_arith_overflow):
            Take the address of the memmove source operand.

Reply via email to