Skip to content
Tcl Source Code History Of Ticket 47d66253c92197d3
Login

History Of Ticket 47d66253c92197d3

Artifacts Associated With Ticket 47d66253c92197d3

  1. Ticket change [bfc7fc72a9] (rid 136469) by anonymous on 2014-01-16 04:20:42:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      On 64bit system, the following code returns an unexpected result.
      
      
      (On Linux 32bit machine)
      % lsearch -sorted -integer [lsort -integer {0 2147483648}] 2147483648
      0
      => the value was found
      
      
      (On Linux 64bit machine)
      % lsearch -sorted -integer [lsort -integer {0 2147483648}] 2147483648
      -1
      => the value was not found
      
    5. foundin initialized to: "8.4.20, 8.5.15, 8.6.1"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Important"
    11. status initialized to: "Open"
    12. submitter initialized to: "anonymous"
    13. subsystem initialized to: "17. Commands I-L"
    14. title initialized to: ""lsearch -sorted -integer" on 64bit system"
    15. type initialized to: "Bug"
  2. Ticket change [3b111979b9] (rid 136470) by dgp on 2014-01-16 13:10:35:

    1. icomment:
      [lsort -integer] is not portable.  The interpretation
      it places on values varies with value of
      $tcl_platform(wordSize).  For the same reason, you see:
      
      (On 32-bit system)
      % expr int(2147483648)
      -2147483648
      
      (On 64-bit system)
      % expr int(2147483648)
      2147483648
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [a5110c461a] (rid 136471) by dgp on 2014-01-16 13:19:05:

    1. icomment:
      What this ticket seems to demonstrate, though,
      is that the meaning of "-integer" is inconsistent
      between [lsort] and [lsearch].  I confirm that.
      [lsort] uses Tcl_GetLongFromObj() and [lsearch]
      uses Tcl_GetIntFromObj(), so on systems where
      int and long are different (64-bit systems),
      they are inconsistent.
      
      That's an unfortunate mess.  Whether it's a bug,
      and if so whether fixing it would solve more problems
      or create more new ones, I'll have to discuss with
      others.
      
      This is all a symptom of the messy stew of integer
      treatment in Tcl that history has delivered to us.
      See TIP 297.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [e3a7978e58] (rid 136472) by dkf on 2014-01-16 15:34:30:

    1. assignee changed to: "dkf"
    2. icomment:
      I'm tempted to say that the meaning of “<tt>-integer</tt>” that a reasonable user would expect would correspond to “anything that satisfies <tt>string is entier -strict</tt>”; limiting to signed-platform-word is… surprising.
      
    3. login: "dkf"
    4. mimetype: "text/html"
    5. username: "dkf"
  5. Ticket change [ea14cc3bc8] (rid 138063) by dkf on 2014-05-11 10:43:25:

    1. login: "dkf"
    2. mimetype: "text/plain"
    3. priority changed to: "7 High"
  6. Ticket change [c7356d7188] (rid 138064) by dkf on 2014-05-11 22:38:21:

    1. icomment:
      However, a minimal first fix would be to switch to using a <tt>long</tt> and get rid of a <i>little bit</i> of the difference between 32-bit and 64-bit.
      <p>
      At least it's not something which is exposed in an API.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  7. Ticket change [caea6eec5e] (rid 138069) by jan.nijtmans on 2014-05-12 13:09:29:

    1. icomment:
      I agree with Donald that as first-fix the data-type could be up-scaled, but I would go one little step further: use Tcl_WideInt in both commands. See branch "bug-47d66253c9".
      
      That would resolve a related strange result (reproduced on win32):
      
      % lsearch -sorted -integer [lsort -integer {0 -2147483648}] 2147483648
      0
      
      2 % lsearch -sorted -integer [lsort -integer {0 2147483648}] -2147483648
      0
      
      Agreed? I don't see any unexpected side-effects from such a change.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  8. Ticket change [a839bb7fbe] (rid 138177) by jan.nijtmans on 2014-05-17 07:03:46:

    1. icomment:
      Upgrade to Tcl_WideInt part now committed to trunk [f70fa16889]. I don't have any objections backporting this to core-8-5-branch, or enhance it further to work for bignums as well. Therefore keeping this open.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  9. Ticket change [64101b252d] (rid 207178) by jan.nijtmans on 2022-11-22 22:47:20:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2459906.44954809"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Dup of [3216010]. Fix already committed, so closing.
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"