Overview
| Artifact ID: | d8077394467b4836ef8e861f7b831b4384476e8e |
|---|---|
| Ticket: | 526717ffffffffffffffffffffffffffffffffff
list indexing corrupts wide ints |
| User & Date: | dgp on 2002-03-07 00:33:14 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
Use of a Tcl_WideInt as a list index will shimmer it to an "int". On a 32-bit platform: % set index [expr {(wide(1)<<31) - 2}] 2147483646 % lindex {1 2 3} $index % incr index 2147483647 % incr index -2147483648 Contrast with: % set index [expr {(wide(1)<<31) - 2}] 2147483646 % incr index 2147483647 % incr index 2147483648 It's worse on 64-bit platforms, where truncation is to an "int" even though Tcl_Integers are really longs: % set index [expr {wide(1)<<32}] 4294967296 % lindex {1 2 3} $index 1 % incr index 4294967297 % lindex {1 2 3} $index 2 So here, we don't lose range on the index values, but the indexing function "wraps around". Suspect trouble in TclGetIntForIndex - foundin changed to: "obsolete: 8.4a5"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "10. Objects"
- title changed to: "list indexing corrupts wide ints"
- type changed to: "Bug"