From b9a4f7d7ca98487e7b66c2c56bc0c9ea7fe6776b Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Tue, 10 Mar 2020 17:18:48 +0100 Subject: [PATCH] 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. --- 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: -- 2.47.2