s390x: Make the CC_DEP1 field appear completely initialised when
writing a 32-bit floating point value into it.
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ 307113.


git-svn-id: svn://svn.valgrind.org/vex/trunk@2724 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_s390_toIR.c b/priv/guest_s390_toIR.c
index f331897..5838804 100644
--- a/priv/guest_s390_toIR.c
+++ b/priv/guest_s390_toIR.c
@@ -632,6 +632,14 @@
 {
    IRExpr *op, *dep1, *dep2, *ndep;
 
+   /* Make the CC_DEP1 slot appear completely defined.
+      Otherwise, assigning a 32-bit value will cause memcheck
+      to trigger an undefinedness error.
+   */
+   if (sizeofIRType(typeOfIRTemp(irsb->tyenv, d1)) == 4) {
+      UInt dep1_off = S390X_GUEST_OFFSET(guest_CC_DEP1);
+      stmt(IRStmt_Put(dep1_off, mkU64(0)));
+   }
    op   = mkU64(opc);
    dep1 = mkexpr(d1);
    dep2 = mkU64(0);
@@ -648,6 +656,14 @@
 {
    IRExpr *op, *dep1, *dep2, *ndep;
 
+   /* Make the CC_DEP1 slot appear completely defined.
+      Otherwise, assigning a 32-bit value will cause memcheck
+      to trigger an undefinedness error.
+   */
+   if (sizeofIRType(typeOfIRTemp(irsb->tyenv, d1)) == 4) {
+      UInt dep1_off = S390X_GUEST_OFFSET(guest_CC_DEP1);
+      stmt(IRStmt_Put(dep1_off, mkU64(0)));
+   }
    op   = mkU64(opc);
    dep1 = mkexpr(d1);
    dep2 = s390_cc_widen(d2, False);