summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-03-13 17:03:50 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-03-13 17:03:50 (GMT)
commitdaac4e5d3412030256d30b357bd455dbfa09630f (patch)
treef9cacd163f5e04dac753c5e9565bcd07ccef0f36 /generic
parent57ceb807ca021ae3375b8769b80eb623e8bd7383 (diff)
downloadtcl-daac4e5d3412030256d30b357bd455dbfa09630f.zip
tcl-daac4e5d3412030256d30b357bd455dbfa09630f.tar.gz
tcl-daac4e5d3412030256d30b357bd455dbfa09630f.tar.bz2
Different solution to silencing the non-useful valgrind alerts.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclObj.c19
2 files changed, 18 insertions, 3 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 65ef1c6..4d3c0b1 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4521,7 +4521,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
do { \
TclInvalidateStringRep(objPtr); \
TclFreeIntRep(objPtr); \
- (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \
(objPtr)->internalRep.doubleValue = (double)(d); \
(objPtr)->typePtr = &tclDoubleType; \
} while (0)
@@ -4571,7 +4570,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \
(objPtr)->internalRep.doubleValue = (double)(d); \
(objPtr)->typePtr = &tclDoubleType; \
TCL_DTRACE_OBJ_CREATE(objPtr); \
diff --git a/generic/tclObj.c b/generic/tclObj.c
index d549fdc..3bf5b8e 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2203,7 +2203,6 @@ Tcl_DbNewDoubleObj(
TclDbNewObj(objPtr, file, line);
objPtr->bytes = NULL;
- objPtr->internalRep.twoPtrValue.ptr2 = NULL; /* valgrind */
objPtr->internalRep.doubleValue = dblValue;
objPtr->typePtr = &tclDoubleType;
return objPtr;
@@ -4489,6 +4488,24 @@ Tcl_RepresentationCmd(
objv[1]->typePtr ? objv[1]->typePtr->name : "pure string",
objv[1]->refCount, ptrBuffer);
+ /*
+ * This is a workaround to silence reports from `make valgrind`
+ * on 64-bit systems. The problem is that the test suite
+ * includes calling the [represenation] command on values of
+ * &tclDoubleType. When these values are created, the "doubleValue"
+ * is set, but when the "twoPtrValue" is examined, its "ptr2"
+ * field has never been initialized. Since [representation]
+ * presents the value of the ptr2 value in its output, valgrind
+ * alerts about the read of uninitialized memory.
+ *
+ * The general problem with [representation], that it can read
+ * and report uninitialized fields, is still present. This is
+ * just the minimal workaround to silence one particular test.
+ */
+
+ if ((sizeof(void *) > 4) && objv[1]->typePtr == &tclDoubleType) {
+ objv[1]->internalRep.twoPtrValue.ptr2 = NULL;
+ }
if (objv[1]->typePtr) {
sprintf(ptrBuffer, "%p:%p",
(void *) objv[1]->internalRep.twoPtrValue.ptr1,