[Bug target/97535] [9/10 Regression] On AArch64 memcpy expansion cannot handle length > 32-bit signed int max

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 17 10:25:39 GMT 2020


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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Tamar Christina
<tnfchris@gcc.gnu.org>:

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

commit r9-9052-g9d65095e72502c12903e202cfe2e1fc58140522a
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Tue Oct 27 16:30:31 2020 +0000

    AArch64: Fix overflow in memcopy expansion on aarch64.

    Currently the inline memcpy expansion code for AArch64 is using a signed
int
    to hold the number of elements to copy.  When you giver give it a value
larger
    than INT_MAX it will overflow.

    The overflow causes the maximum number of instructions we want to expand to
    check to fail since this assumes an unsigned number.

    This patch changes the maximum isns arithmetic to be unsigned
HOST_WIDE_INT.

    note that the calculation *must* remained signed as the memcopy issues
    overlapping unaligned copies.  This means the pointer must be moved back
and
    so you need signed arithmetic.

    gcc/ChangeLog:

            PR target/97535
            * config/aarch64/aarch64.c (aarch64_expand_cpymem): Use unsigned
            arithmetic in check.

    gcc/testsuite/ChangeLog:

            PR target/97535
            * gcc.target/aarch64/pr97535.c: New test.

    (cherry picked from commit 0f801e0b6cc9f67c9a8983127e23161f6025c5b6)


More information about the Gcc-bugs mailing list