]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390x: Fix down-cast from memory operand with size < 8
authorAndreas Arnez <arnez@linux.ibm.com>
Tue, 10 Mar 2020 16:18:48 +0000 (17:18 +0100)
committerAndreas Arnez <arnez@linux.ibm.com>
Fri, 13 Mar 2020 18:12:47 +0000 (19:12 +0100)
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

index 5d26825daf7d5b5aeb74a36c8ebc394d181d8285..00b4aee8182877137c21111ca3a454f45b1639f0 100644 (file)
@@ -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: