|
From: Andreas A. <ar...@so...> - 2020-03-13 19:36:26
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=b9a4f7d7ca98487e7b66c2c56bc0c9ea7fe6776b commit b9a4f7d7ca98487e7b66c2c56bc0c9ea7fe6776b Author: Andreas Arnez <ar...@li...> Date: Tue Mar 10 17:18:48 2020 +0100 s390x: Fix down-cast from memory operand with size < 8 A down-cast always copies 8 bytes from the source operand, even if the operand is actually smaller. This doesn't matter for register operands, but it does for memory operands. Fix this and copy the correct number of bytes instead. Diff: --- VEX/priv/host_s390_isel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 5d26825daf..00b4aee818 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -1893,7 +1893,8 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr) /* Down-casts are no-ops. Upstream operations will only look at the bytes that make up the result of the down-cast. So there is no point setting the other bytes to 0. */ - insn = s390_opnd_copy(8, dst, opnd); + size = sizeofIRType(typeOfIRExpr(env->type_env, arg)); + insn = s390_opnd_copy(size, dst, opnd); break; case Iop_64HIto32: |