| Ticket UUID: | 3402540 | ||
| Title: | expr parser and "nan()" | ||
| Type: | Bug | Created on: | 2011-09-01 15:40:39 |
| Submitter: | dgp | Assigned to: | dgp |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 9 Immediate | Last modified: | 2011-09-02 01:27:59 |
| Status: | Closed | Closed by: | dgp |
| Resolution: | Fixed | Closed on: | 2011-09-01 18:27:59 |
| Version: | obsolete: 8.5.10 | ||
| Description: | ||||
% expr {nan()}
missing operator at _@_
in expression "...es.
#
# Copyright (c) _@_"
Something's way off here, sending us
where we shouldn't be going.
| ||||
| User Comments: | ||||
ferrieux added on 2011-09-01 22:52:08:
Also broken in 8.6 trunk and *not* fixed by the bug-3401704 patch. ferrieux added on 2011-09-01 22:58:37:
It goes astray because in sNANPAREN the case of en empty argument is not checked, hence the closing paren is taken as an hex digit, and the final \0 continues into the state machine... Will fix by adding an "else" in sNANPAREN. dgp added on 2011-09-01 23:03:51:
related bugs: % string is double nan(1,2,3,4,5) 1 % string is double nan( 1 Patch on the way. ferrieux added on 2011-09-01 23:05:36:
--- generic/tclStrToD.c
+++ generic/tclStrToD.c
@@ -1099,10 +1099,14 @@
d = c - '0';
} else if (c >= 'a' && c <= 'f') {
d = 10 + c - 'a';
} else if (c >= 'A' && c <= 'F') {
d = 10 + c - 'A';
+ } else {
+ /* Nan(NotHex) or Nan() => we stop at Nan */
+ /* acceptPoint and acceptLen have been set in sNAN */
+ goto endgame;
}
significandWide = (significandWide << 4) + d;
state = sNANHEX;
break;
}
ferrieux added on 2011-09-01 23:07:06:
sorry, xed. This patch fixes it by parsing Nan() and Nan(nonhex) as "Nan"+"(...)". Is it okay ? dgp added on 2011-09-01 23:07:19:
Yes, that plus adding the missing increment on numSigDigs. Will commit after adding tests as well. dgp added on 2011-09-02 01:27:59:
allow_comments - 1 | ||||
