From: Andreas Arnez Date: Tue, 10 Mar 2020 16:18:48 +0000 (+0100) Subject: s390x: Fix down-cast from memory operand with size < 8 X-Git-Tag: VALGRIND_3_16_0~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a4f7d7ca98487e7b66c2c56bc0c9ea7fe6776b;p=thirdparty%2Fvalgrind.git 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 --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: