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

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

https://gcc.gnu.org/g:9f8ba332e988fb582f6ca32465f6d65283f53b3a

commit r14-8186-g9f8ba332e988fb582f6ca32465f6d65283f53b3a
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Jan 17 14:43:40 2024 +0100

    lower-bitint: Avoid overlap between destinations and sources in libgcc
calls [PR113421]

    The following testcase is miscompiled because the bitint lowering emits a
      .MULBITINT (&a, 1024, &a, 1024, &x, 1024);
    call.  The bug is in the overlap between the destination and source, that
is
    something the libgcc routines don't handle, they use the source arrays
    during the entire algorithms which computes the destination array(s).
    For the mapping of SSA_NAMEs to VAR_DECLs the code already supports that
    correctly, but the checking whether a load from memory can be used directly
    without a temporary even when earlier we decided to merge the
    multiplication/division/modulo etc. with a store didn't.

    The following patch implements that.

    2024-01-17  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/113421
            * gimple-lower-bitint.cc (stmt_needs_operand_addr): Adjust function
            comment.
            (bitint_dom_walker::before_dom_children): Add g temporary to
simplify
            formatting.  Start at vop rather than cvop even if stmt is a store
            and needs_operand_addr.

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

Reply via email to