PR target/99314: Fix integer signedness issue for cpymem pattern expansion.
authorSinan Lin <sinan@isrc.iscas.ac.cn>
Thu, 4 Mar 2021 10:02:39 +0000 (18:02 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 18 Mar 2021 16:04:32 +0000 (00:04 +0800)
commitd9f0ade001533c9544bf2153b6baa8844ec0bee4
tree8eecdce257f1dcb48988439276135d6880e48087
parent89d44a9f3b9ab97634b7ef894e2c83ebd83582a8
PR target/99314: Fix integer signedness issue for cpymem pattern expansion.

Third operand of cpymem pattern is unsigned HOST_WIDE_INT, however we
are interpret that as signed HOST_WIDE_INT, that not a problem in
most case, but when the value is large than signed HOST_WIDE_INT, it
might screw up since we have using that value to calculate the buffer
size.

2021-03-05  Sinan Lin  <sinan@isrc.iscas.ac.cn>
    Kito Cheng  <kito.cheng@sifive.com>

gcc/ChangeLog:

* config/riscv/riscv.c (riscv_block_move_straight): Change type
to unsigned HOST_WIDE_INT for parameter and local variable with
HOST_WIDE_INT type.
(riscv_adjust_block_mem): Ditto.
(riscv_block_move_loop): Ditto.
(riscv_expand_block_move): Ditto.
gcc/config/riscv/riscv.c