optimisation reveals integer/wide problems
Closed / Fixed1251791fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-08-04 11:45:08
The optimisation that preserves a Tcl_Obj when
appending an empty string only happens for bytecoded
scripts. Combined with integer/wide difficulties, this
produces inconsistent results when the same script is
bcc'ed or not.
mig@ave:/home/CVS/tcl-core-8-4-branch/unix$ cat > /tmp/test
proc test {} {
set res [info patchlevel]
set a [expr {wide(65536)}]
lappend res [expr {$a*$a}]
set b $a[set a ""]
lappend res [expr {$b*$b}]
}
puts [test]
set res [info patchlevel]
set a [expr {wide(65536)}]
lappend res [expr {$a*$a}]
set b $a[set a ""]
puts [lappend res [expr {$b*$b}]]
mig@ave:/home/CVS/tcl-core-8-4-branch/unix$ ./tclsh
/tmp/test
8.4.11 4294967296 4294967296
8.4.11 4294967296 0
msoferplain2005-08-04 18:53:29
Logged In: YES user_id=148712 Note that the bug is present since 8.4.8 and in HEAD too. Previous releases produce a consistent output: 8.4.7 4294967296 0 8.4.7 4294967296 0
dkfplain2005-08-04 19:09:11
Logged In: YES user_id=79902 The fact that wide(65536) != 65536 is the problem in many respects. The optimization is just a means of exposing it.
msoferplain2005-10-22 10:08:40
Logged In: YES user_id=148712 Fixed in HEAD by the bignum implementation; fixed in 8.4 by disabling the optimisation for wide integers.
Log in (anonymous is fine) to add a comment.