|
2007-06-18
| ||
| 17:52 | • Closed ticket [1735583fff]: Test expr-47.12 fails on linux plus 6 other chan... artifact: 4f150c3051 user: fridolin | |
| 09:05 | • Ticket [1735583fff]: 4 changes artifact: 22a3d52fe3 user: kennykb | |
|
2007-06-15
| ||
| 19:24 | • Open ticket [1735583fff]. artifact: ebcab26cb2 user: fridolin | |
|
2007-06-12
| ||
| 21:01 | • Pending ticket [1735583fff]. artifact: 056b5febd6 user: dgp | |
| 09:09 | • New ticket [1735583fff]. artifact: e7bb4eda0a user: fridolin | |
Test expr-47.12 fails on linux
Closed / Duplicate1735583fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-06-12 09:09:58
gcc was 4.1.2, x86 processor, an older glibc
==== expr-47.12 isqrt of various sizes of integer FAILED
==== Contents of test case:
set faults 0
for {set i 0} {$faults < 10 && $i <= 1024} {incr i} {
set root [expr {1 << $i}]
set rm1 [expr {$root - 1}]
set arg [expr {1 << (2 * $i)}]
set tval [expr {isqrt($arg-1)}]
if {$tval != $rm1} {
append trouble "i = " $i ": isqrt(" $arg "-1) == " $tval " != " $rm1 "\n"
incr faults
}
set tval [expr {isqrt($arg)}]
if {$tval != $root} {
append trouble "i = " $i ": isqrt(" $arg ") == " $tval " != " $root "\n"
incr faults
}
set tval [expr {isqrt($arg+1)}]
if {$tval != $root} {
append trouble "i = " $i ": isqrt(" $arg "+1) == " $tval " != " $root "\n"
incr faults
}
}
set trouble
---- Result was:
i = 28: isqrt(72057594037927936-1) == 279620267 != 268435455
i = 28: isqrt(72057594037927936+1) == 279620267 != 268435456
i = 29: isqrt(288230376151711744-1) == 545818760 != 536870911
i = 29: isqrt(288230376151711744+1) == 545818760 != 536870912
i = 30: isqrt(1152921504606846976-1) == 1079707056 != 1073741823
i = 30: isqrt(1152921504606846976+1) == 1079707056 != 1073741824
i = 31: isqrt(4611686018427387904-1) == 2150992608 != 2147483647
i = 31: isqrt(4611686018427387904+1) == 2150992608 != 2147483648
i = 32: isqrt(18446744073709551616-1) == 4296881274 != 4294967295
i = 41: isqrt(4835703278458516698824704-1) == 2199023259647 != 2199023255551
---- Result should have been (exact matching):
==== expr-47.12 FAILED
dgpplain2007-06-12 21:01:27
Logged In: YES user_id=80530 Originator: NO Dup of 1609936?
fridolinplain2007-06-15 19:24:12
Logged In: YES user_id=13583 Originator: YES Yes, it is an duplicate. Tcl is compiled with gcc-4.1.2. If bn_mp_sqrt.c is compiled with -O0 helps, then the expr test doesn't fail anymore (CVS head branch).
kennykbplain2007-06-18 09:05:15
Logged In: YES user_id=99768 Originator: NO Your remark about 'an older glibc' may be a key. Since it appears that it's the 'ldexp' function that's failing -- or at least, that's what happened the earlier time that we saw these exact symptoms - it could be that rather than the compiler's being at fault, it's the library. In any case, trying with a library that (at least) matches the compiler would provide a useful data point. I really, really want to avoid the endless rat race of coding around everyone's bugs in compilers and standard libraries. ldexp is a fundamental floating-point operation; it's in the standard library because it's insanely difficult to do in a portable fashion -- except in cases of over/underflow, it's required to return an exact result. I concede that we do work around bugs in MSVC - but that compiler enjoys something of a privileged status because, well frankly, because a tremendous number of people use it in spite of the fact that Microsoft has an abysmal record of fixing bugs.
fridolinplain2007-06-18 17:52:23
Logged In: YES user_id=13583 Originator: YES I guess it's not the glibc but an gcc optimizer bug, since recompiling with -O0 fixes the problem with the same old glibc. (The gcc is build from sources against this old glibc). But anyway, I close this bug, since it it related to gcc (or glibc).
Log in (anonymous is fine) to add a comment.