Artifacts Associated With Ticket 868489ffffffffff
Ticket change [acc0e46e74] (rid 101347) by kennykb on 2003-12-31 16:09:54:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Consider the following: set x -2366755200 string is integer $x set y [expr { wide($x) }] The value of y that results is 1928212096 The problem is that the generated code for the expression sees the "integer" internal representation and uses it, even though reconverting the string rep would yield a different value. The particular code in question is in the "ExprCallMathFunc" function in tclExecute.c, but the problem appears to be pretty pervasive. It appears to be incorrect to promote an "integer" to a "wide" if the "integer" has a string representation. - foundin initialized to: "obsolete: 8.4.5"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "kennykb"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "Incorrect promotion of int to wide"
- type initialized to: "Support"
Ticket change [84b01c1634] (rid 117602) by dkf on 2004-01-05 22:27:33:
- icomment:
Logged In: YES user_id=79902 Why is [string is integer] setting the type of the object?
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [658830d737] (rid 102563) by kennykb on 2004-01-05 22:49:10:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=99768 [string is integer] was just an example. The code that first tripped over the bug actually used [clock format]. It fails on anything that gets into SetIntFromAny.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [63b5fbfd03] (rid 92625) by dkf on 2004-01-20 05:28:22:
- icomment:
Logged In: YES user_id=79902 The problem is how to fix this; how to detect that we are in an "annoying integer overflow" situation and mark the object so that we know when converting to wide to go from the string version and not the internal rep (which would otherwise be far faster.) :^/ At best, this is a huge amount of work to fix. (New arithmetic object types require action in ever so many places!) I don't think I'm likely to have the free time to take this on in the near future, so if anyone wishes to have a go, please feel free!
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [f06853eb32] (rid 109190) by kennykb on 2004-01-21 01:58:52:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=99768 The given test case works in Tcl up until the change: 2003-04-11 Don Porter <[email protected]> * generic/tclCmdMZ.c (Tcl_StringObjCmd,STR_IS_INT): Corrected inconsistent results of [string is integer] observed on systems where sizeof(long) != sizeof(int). [Bug 718878] * tests/string.test: Added tests for Bug 718878. * doc/string.n: Clarified that [string is integer] accepts 32-bit integers. But this change is an innocent victim; replacing [string is integer] with [clock format] will tickle the bug in earlier releases.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [0f042100ee] (rid 94718) by kennykb on 2004-01-21 02:01:44:
- assignee changed to: "dkf"
- priority changed to: "7 High"
Add attachment "868489.patch" [a7338ac51e] (rid 98749) by kennykb on 2004-04-22 02:25:37.
Ticket change [ec0c656305] (rid 103641) by kennykb on 2004-04-22 02:25:37:
- icomment:
File Added - 84569: 868489.patch Logged In: YES user_id=99768 It occurs to me that the easiest way to mark that the annoying overflow has occurred is simply to make it a wide integer instead of an ordinary one. The attached patch does the following: Makes Tcl_GetIntFromObj and Tcl_GetLongFromObj check for tclWideIntType as well as tclIntType, and do direct conversion of the intenal rep from wide to int (with a range check). Also changes the conversion from string to a new SetIntOrWideFromAny. The new SetIntOrWideFromAny is just like the old SetIntFromAny except that it checks for integer overflow and uses a tclWideIntType instead of a tclIntType for values that don't fit in a 'long' - avoiding inconsistent internal reps. The existing SetIntFromAny has its range checks tightened to avoid setting an internal representation that is inconsistent with the string rep (an error is thrown instead). There are potential incompatibilities here because of the tightened range in SetIntFromAny and the fact that Tcl_GetIntFromObj is no longer guaranteed to leave a specific internal representation. It is arguable that any code that runs afoul of either incompatibility is buggy anyway. New test cases provided for the obvious problem spots.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [9b686024ba] (rid 111117) by dkf on 2004-04-22 02:59:47:
- icomment:
Logged In: YES user_id=79902 That patch looks comparatively likely. What is the impact of this sort of treatment on number handling in TEBC and its helpers? I know that that code is *not* very clean, so it might get quite surprised...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [e889464db5] (rid 104662) by kennykb on 2004-04-23 02:05:40:
- icomment:
Logged In: YES user_id=99768 Uhm, Donal, much of that appears to be *your* code. :) Nevertheless, I took a few quick trolls through TEBC, and didn't see any *obvious* problems - all the code that accesses objPtr->internalRep.longValue seems to check the type first; likewise for wideValue. Emphasis on 'obvious' is intentional.
- login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
- icomment:
Ticket change [ea3f920bad] (rid 103336) by dkf on 2004-04-23 15:23:12:
- icomment:
Logged In: YES user_id=79902 Of course that code is my code. How do you think I know it is a mess? :^/ I can't check the code right now; my sandbox has other toys in it (TIP#143 implementation as it happens) and I don't want to get them mixed up. If/when I get that out of the way, I'll be able to work on this area in more detail.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [2e42378f54] (rid 119196) by dkf on 2004-09-11 04:53:23:
- closedate changed to: "2004-09-10T21:53:23"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Patch looked just about good enough to me Applied to HEAD and 8.4 branch
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: ""
- status changed to: "Closed"
- username: "dkf"
Ticket change [a91e5e94c6] (rid 99105) by dgp on 2004-09-14 23:03:11:
- icomment:
Logged In: YES user_id=80530 Patch appears to have created new Bug 1027690.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [912d72b1f6] (rid 120581) by dkf on 2004-09-16 14:10:52:
- icomment:
Logged In: YES user_id=79902 And it closed another bug (I've already forgotten the number) at the same time. Track the problem in 1027690...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [1e89a3e561] (rid 90993) by dkf on 2004-09-16 15:17:34:
- icomment:
Logged In: YES user_id=79902 Oh, I see you fixed it already. :} And I see it was a simple fix. And I see that the reason I didn't find it in testing was endianness. Oh well.. Thanks for finding it.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [8921fe5c5d] (rid 131980) by dkf on 2008-11-02 18:31:57:
- foundin changed to: "None"
- icomment:
data_type - 210894
- is_private changed to: "1"
- login: "dkf"
- mimetype: "text/plain"
- subsystem changed to: "None"
- username: "dkf"
Ticket change [f42b9025c1] (rid 129862) by dkf on 2009-07-29 19:41:11:
- icomment:
IP - Comment Removed: 130.88.1.31
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment: