Overview
| Artifact ID: | ec0c656305b0cb7893c67b3c914213cfc4658ea0 |
|---|---|
| Ticket: | 868489ffffffffffffffffffffffffffffffffff
Incorrect promotion of int to wide |
| User & Date: | kennykb on 2004-04-22 02:25:37 |
Changes
- 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"