|
2004-09-19
| ||
| 22:05 | • Closed ticket [868467ffff]: large shift ops wrong plus 7 other changes artifact: ccb565e50f user: dkf | |
| 05:40 | • Open ticket [868467ffff]. artifact: 3e9b7b6731 user: dgp | |
| 02:25 | • Closed ticket [868467ffff]. artifact: 5b3b40623f user: dkf | |
| 01:04 | • Ticket [868467ffff]: 5 changes artifact: 31986afdef user: dkf | |
|
2004-06-16
| ||
| 17:36 | • Ticket [868467ffff]: 1 change artifact: 5dee912c3d user: dkf | |
|
2004-01-12
| ||
| 18:56 | • Ticket [868467ffff]: 4 changes artifact: 0439587df3 user: msofer | |
| 18:38 | • Ticket [868467ffff]: 4 changes artifact: 1ca3ad453b user: nobody | |
|
2004-01-09
| ||
| 16:38 | • Ticket [868467ffff]: 4 changes artifact: 5362302e2e user: dkf | |
| 06:02 | • Ticket [868467ffff]: 5 changes artifact: 786b9a7e60 user: msofer | |
|
2004-01-08
| ||
| 05:17 | • Open ticket [868467ffff]. artifact: 0e1e1a6da0 user: hinteger | |
|
2004-01-01
| ||
| 23:35 | • Ticket [868467ffff]: 6 changes artifact: ce45df6d0d user: dkf | |
| 23:35 | • Pending ticket [868467ffff]. artifact: d2b8c0627c user: dkf | |
|
2003-12-31
| ||
| 15:12 | • New ticket [868467ffff]. artifact: db4039b116 user: hinteger | |
large shift ops wrong
Closed / Fixed868467ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 22 years ago
Descriptionplain2003-12-31 15:12:43
expr does not deliver correct results for <</>>, if the
shift count is equal (or greater) the bitcount of an
integer.
e.g. expr 5>>32 gives 5, instead of expected 0
expr 5>>33 gives 2, instead of expected 0
Ok, as someone said on clt, this isn't covered in C89
Standard too, but do we have to stick to faulty
standards, that were set up years ago.
For implementing shifts of bit fields wider than int,
this is required to work correctly (ok, I could do
conditional expr's, but the code gets quite ugly)
dkf Pending ticket [868467ffff].
[History diff]2004-01-01 23:35:50
dkfplain2004-01-01 23:35:51
Logged In: YES user_id=79902 Tcl just fires the value off to the C runtime's standard shifting mechanism, and always has done AFAICT. We don't do range checks on the shift parameter. If it is wrong, it's a compiler, runtime or processor fault. Not closing outright as perhaps this is something we could check for. But I'm not inclined to do anything about it.
hintegerplain2004-01-08 05:17:32
Logged In: YES user_id=124720 Regardless who's to blame for that, the result is not correct. I'll take a look at the code and send a patch.
msoferplain2004-01-09 06:02:19
Logged In: YES user_id=148712 assigning to knowledgeable developer ...
dkfplain2004-01-09 16:38:21
Logged In: YES user_id=79902 Which platform is this on BTW? And which compiler was used? I ask because a VC++ 5.2 compiler bug was found recently in the handling of shifts of 64-bit values.
nobodyplain2004-01-12 18:38:21
Logged In: NO this is on linux x86 with gcc 3.2. I got responses on c.l.t., that Standard C89 doesn't define this, so probably any compiler will give us an incorrect result, but ther's no reason to do a shift count check and return 0 in all cases where the shift count is greater or equal bitcount of integer. btw. means >assigning to knowledgeable developer ... there's no need for a patch anymore ? I didn't have time to submit a patch, maybe I'll make it this week I'll , but I can test only on Linux, I don't have a Win* Environment ! Gerhard
msoferplain2004-01-12 18:56:04
Logged In: YES user_id=148712 No, it means: when a patch is submitted, it'll get judged by someone who's got a clue ;)
dkf Ticket [868467ffff]: 1 change
[History diff]2004-06-16 17:36:27
dkfplain2004-09-19 01:04:20
Logged In: YES user_id=79902 Fixed in HEAD.
dkfplain2004-09-19 02:25:51
Logged In: YES user_id=79902 And in 8.4 branch too.
dgpplain2004-09-19 05:40:35
Logged In: YES user_id=80530 patched HEAD fails the following tests on a 64-bit platform: ==== expr-24.5 expr edge cases; shifting FAILED ==== Contents of test case: expr int(5)<<32 ---- Result was: 21474836480 ---- Result should have been (exact matching): 0 ==== expr-24.5 FAILED ==== expr-24.6 expr edge cases; shifting FAILED ==== Contents of test case: expr int(5)<<63 ---- Result was: -9223372036854775808 ---- Result should have been (exact matching): 0 ==== expr-24.6 FAILED
dkfplain2004-09-19 22:05:43
Logged In: YES user_id=79902 OK, those tests are failing because I'm not very good at writing tests, and not because what they are testing is failing. Silenced.
Log in (anonymous is fine) to add a comment.