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

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

https://gcc.gnu.org/g:332e891a8a42a9ba971174c8282864fbc1976b7f

commit r15-10205-g332e891a8a42a9ba971174c8282864fbc1976b7f
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Aug 6 11:28:37 2025 +0200

    bitint: Fix up handling of uninitialized mul/div/float cast operands
[PR121127]

    handle_operand_addr (used for the cases where we use libgcc APIs, so
    multiplication, division, modulo, casts of _BitInt to float/dfp) when it
    sees default definition of an SSA_NAME which is not PARM_DECL (i.e.
    uninitialized one) just allocates single uninitialized limb, there is no
    need to waste more memory on it, it can just tell libgcc that it has
    64-bit precision, not say 1024 bit etc.
    Unfortunately, doing this runs into some asserts when we have a narrowing
    cast of the uninitialized SSA_NAME (but still large/huge _BitInt).

    The following patch fixes that by using a magic value in *prec_stored
    for the uninitialized cases (0) and just don't do any *prec tweaks for
    narrowing casts from that.  precs still needs to be maintained as before,
    that one is used for big endian adjustment.

    2025-08-06  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/121127
            * gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
For
            uninitialized SSA_NAME, set *prec_stored to 0 rather than *prec.
            Handle that case in narrowing casts.  If prec_stored is non-NULL,
            set *prec_stored to prec_stored_val.

            * gcc.dg/bitint-125.c: New test.

    (cherry picked from commit d175a6b119b8ab177ab9d9fb81dcac1794d18ad6)

Reply via email to