Fix for bug 124600
Closed402663ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
kennykbplain2000-12-06 03:00:17
Patch adds two test cases for the correct recovery of large integers. All tests continue to pass with patch applied.
dkfplain2000-12-06 17:24:55
I'd rather build MIN_INT and MAX_INT with the bit shift and bit negation operators, but I suppose that's just a matter of style. Also stylistically speaking, if the values of MIN_INT and MAX_INT are shared between the tests, surely they should be computed outside the tests, but just in the main body of the file?
kennykbplain2000-12-06 22:45:02
I'd rather build MIN_INT and MAX_INT with bit shift and negation myself, but couldn't find a convenient way to do it.
( 1 << 31 ) for MIN_INT might work, except that it messes up the 64-bit port.
( -1 >> 1 ) might define MAX_INT, except that >> is an arithmetic right-shift and sign extends the damned thing:
( -1 >> 1 ) == -1 !
(I probably ought to work up a TIP for an unsigned shift-right operator, perhaps '>>>'.)
The rules for setting up tests have never been clear to me. Most of the other Tcl tests are entirely self-contained; in very, very few places is there code in the body of the file, except for cleaning up after failed tests. If you'd rather hoist the code out, and you understand the implications, by all means go ahead.
dgpplain2000-12-06 22:48:49
I agree with Donal's comments. See the proc [largest_int] in tests/string.test for an example.
kennykbplain2000-12-07 02:01:57
Patch Code - Modified - New Version OK, the revised patch has an [int_range] procedure analogous to the [largest_int] proc in tests/string.tests, and deletes it after the two tests run. It also replaces the addition with bit shift and uses bitwise negation to make MAX_INT out of MIN_INT.
hobbsplain2000-12-10 10:03:00
Looks clean, commited 9 Dec 2000 (tested Windows and Solaris).
dgpplain2000-12-11 10:45:15
The tests scan-4.62 and scan-4.63 fail on
RedHat Linux 6.2 on an Alpha XL-300 (64-bit):
% int_range
-9223372036854775808 9223372036854775807
% foreach { MIN_INT MAX_INT } [int_range] {}
% format %o $MAX_INT
integer value too large to represent as non-long integer
A new bug in [format]? Or just tests that weren't
written carefully enough?
kennykbplain2000-12-12 00:22:08
Don's trouble on a 64-bit Linux is already documented as bug 119223. It isn't a new regression, just an incomplete 64-bit port.
dgp Ticket [402663ffff]: 3 changes
[History diff]2001-04-05 08:11:56
Log in (anonymous is fine) to add a comment.
Attachments:
- None [download] added by kennykb on 2000-12-06 02:59:22. [details]