summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-01 14:55:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-01 14:55:02 (GMT)
commit680d27740a871cd27464c07ed2afee0f4104dbd4 (patch)
tree894906755f09fc8f29d4759777fafb3f94fac8bd /generic
parent4a6021fe4842ba393545d968beed09fa19745a22 (diff)
parent8259c261067c140fd2db07d72c8eb9883b949aa0 (diff)
downloadtcl-680d27740a871cd27464c07ed2afee0f4104dbd4.zip
tcl-680d27740a871cd27464c07ed2afee0f4104dbd4.tar.gz
tcl-680d27740a871cd27464c07ed2afee0f4104dbd4.tar.bz2
Fix [d0f7ba56f0e8f93b7efb5b09ebc30a824bdd577a|d0f7ba56f0]: INST_EQ first-argument NaN shortcut is too aggressive
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 9103da0..c0dc9c0 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5950,16 +5950,17 @@ TEBCresume(
value2Ptr = OBJ_AT_TOS;
valuePtr = OBJ_UNDER_TOS;
- if (GetNumberFromObj(NULL, valuePtr, &ptr1, &type1) != TCL_OK) {
+ if (GetNumberFromObj(NULL, valuePtr, &ptr1, &type1) != TCL_OK
+ || GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2) != TCL_OK) {
/*
* At least one non-numeric argument - compare as strings.
*/
goto stringCompare;
}
- if (type1 == TCL_NUMBER_NAN) {
+ if (type1 == TCL_NUMBER_NAN || type2 == TCL_NUMBER_NAN) {
/*
- * NaN first arg: NaN != to everything, other compares are false.
+ * NaN arg: NaN != to everything, other compares are false.
*/
iResult = (*pc == INST_NEQ);
@@ -5969,21 +5970,6 @@ TEBCresume(
compare = MP_EQ;
goto convertComparison;
}
- if (GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2) != TCL_OK) {
- /*
- * At least one non-numeric argument - compare as strings.
- */
-
- goto stringCompare;
- }
- if (type2 == TCL_NUMBER_NAN) {
- /*
- * NaN 2nd arg: NaN != to everything, other compares are false.
- */
-
- iResult = (*pc == INST_NEQ);
- goto foundResult;
- }
if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) {
l1 = *((const long *)ptr1);
l2 = *((const long *)ptr2);