Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Test failures in "string is"

Closed / Fixede663138a06d98e48b5fbb42cc015cf1698f486cdCreated 13 years agoUpdated 13 years ago
Descriptionplain2014-04-09 12:40:22
When running the test-suite on Win32 or Win64, see test results below:
I see those failures only on Windows, not on UNIX or Cygwin.

Bisecting shows that this problem was introduced with commit [f74647ceeb7e1692]

==========================================================
Tests began at Wed Apr 09 14:17:33 CEST 2014
obj.test


==== obj-33.1 integer overflow on input FAILED
==== Contents of test case:

    set x 0x8000; append x 0000
    list [string is integer $x] [expr { wide($x) }]

---- Result was:
0 2147483648
---- Result should have been (exact matching):
1 2147483648
==== obj-33.1 FAILED



==== obj-33.2 integer overflow on input FAILED
==== Contents of test case:

    set x 0xffff; append x ffff
    list [string is integer $x] [expr { wide($x) }]

---- Result was:
0 4294967295
---- Result should have been (exact matching):
1 4294967295
==== obj-33.2 FAILED



==== obj-33.5 integer overflow on input FAILED
==== Contents of test case:

    set x -0x8000; append x 0001
    list [string is integer $x] [expr { wide($x) }]

---- Result was:
0 -2147483649
---- Result should have been (exact matching):
1 -2147483649
==== obj-33.5 FAILED



==== obj-33.6 integer overflow on input FAILED
==== Contents of test case:

    set x -0xffff; append x ffff
    list [string is integer $x] [expr { wide($x) }]

---- Result was:
0 -4294967295
---- Result should have been (exact matching):
1 -4294967295
==== obj-33.6 FAILED


Tests ended at Wed Apr 09 14:17:33 CEST 2014
all.tcl:        Total   90      Passed  86      Skipped 0       Failed  4
Sourced 1 Test Files.
Files with failing tests: obj.test
Referenced by3
jan.nijtmans Ticket [e663138a06]: 3 changes [History diff]2014-04-09 12:40:52
jan.nijtmansplain2014-04-09 13:38:17
Just tried the same on Cygwin32, it gave exactly the same failures.
The reason the failures do not occur on Cygwin64 (or any other 64-bit
platform !- Win64) is that the constraint "wideBiggerThanInt" is
not set, which disables those test-cases.

The difference with Tcl 8.5 can be seen here:
$ tclsh8.5
% string is integer -4294967295
1
% string is integer -4294967296
0
% exit

$ tclsh8.6
% string is integer -2147483648
1
% string is integer -2147483649
0
% exit
jan.nijtmanswiki2014-04-10 07:55:17

Fixed in [772c763815]

dgpplain2014-04-14 15:03:38
The patch committed is effective for the set
of symptoms reported, but doesn't address the
deeper defect.

The INST_NUM_TYPE instruction appears based on
the premise that the type values returned by
TclGetNumberFromObj() map onto the classifications
sorted by [string is].  That premise is false.

More bugs like this, I'm sure, can be demonstrated
at the other boundaries between integer classifications.
dgpplain2014-04-14 16:44:09
Clearest bug on current trunk on typical 64-bit
systems:

% string is integer 0x100000000
1

We really don't cover this in the test suite?
Really?
dgpplain2014-04-14 17:14:27
confirmed this bug also arrived with

2014-02-02 16:01:21 f74647ceeb7e1692 BAD
dgpplain2014-04-14 17:23:27
Tests string-6.9[2-4] test this boundary, but
they are non-compiled cases only, so didn't pick
up on this incompat.
dgpplain2014-04-14 18:45:45
Fixed in trunk.
jan.nijtmanswiki2014-04-15 10:46:58

> We really don't cover this in the test suite? > Really? Now we do. Thanks Don!!!! [f13e5bd0cf]

Log in (anonymous is fine) to add a comment.