summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-01 14:42:48 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-01 14:42:48 (GMT)
commit304de510732b5bf301c6d97ca26f876dca26886e (patch)
tree0f28b17551a7475b0c6db0bc401aa8b072e2959d /generic/tclExecute.c
parentf421ab92dcd3d8e15e14424401e18ace004fbb5e (diff)
downloadtcl-304de510732b5bf301c6d97ca26f876dca26886e.zip
tcl-304de510732b5bf301c6d97ca26f876dca26886e.tar.gz
tcl-304de510732b5bf301c6d97ca26f876dca26886e.tar.bz2
Fix [d0f7ba56f0e8f93b7efb5b09ebc30a824bdd577a|d0f7ba56f0]: INST_EQ first-argument NaN shortcut is too aggressive
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index bfb9d17..608b420 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -4496,16 +4496,17 @@ TclExecuteByteCode(
Tcl_WideInt w1, w2;
#endif
- 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);
@@ -4515,21 +4516,6 @@ TclExecuteByteCode(
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;
- }
switch (type1) {
case TCL_NUMBER_LONG:
l1 = *((const long *)ptr1);