https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112537
--- Comment #10 from JuzheZhong <juzhe.zhong at rivai dot ai> --- This following patch: diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc index 57e8ad698d7..c135d4efdb2 100644 --- a/gcc/config/riscv/riscv-string.cc +++ b/gcc/config/riscv/riscv-string.cc @@ -773,7 +773,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in) bnez a2, loop # Any more? ret # Return */ - if (!TARGET_VECTOR) + if (!TARGET_VECTOR || riscv_autovec_preference == NO_AUTOVEC || !flag_tree_vectorize) return false; HOST_WIDE_INT potential_ew = (MIN (MIN (MEM_ALIGN (src_in), MEM_ALIGN (dst_in)), BITS_PER_WORD) Can fix this issue. Is it OK ?