[PATCH 01/21] Fix riscv_expand_block_move

siyu@isrc.iscas.ac.cn siyu@isrc.iscas.ac.cn
Sun Oct 31 09:34:25 GMT 2021


From: linsinan1995 <47880367+linsinan1995@users.noreply.github.com>

---
 gcc/config/riscv/riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 6aef3d3a6cf..0529b6d60cd 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -3491,7 +3491,7 @@ riscv_block_move_loop (rtx dest, rtx src, unsigned HOST_WIDE_INT length,
 bool
 riscv_expand_block_move (rtx dest, rtx src, rtx length)
 {
-  if (CONST_INT_P (length))
+  if (CONST_INT_P (length) && INTVAL (length) >= 0)
     {
       unsigned HOST_WIDE_INT hwi_length = UINTVAL (length);
       unsigned HOST_WIDE_INT factor, align;
-- 
2.25.1



More information about the Gcc-patches mailing list