Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cef68870ce94e3138d1f77db22c9b231d88a483006762ffd47c288dddaa6b72b
Ticket: db36fa5122259be74d0ccadd102e076094703052
compiled lindex botches index artihmetic
User & Date: sebres on 2018-03-01 23:16:44
Changes

  1. icomment:
    Same here:
    <code><pre>
    % lsort -index -1-1 {{1 . c} {2 . b} {3 . a}}
    {3 . a} {2 . b} {1 . c}
    </pre></code>
    
    But still worse (I think it is similar to your fix [650f9e6c7c]):
    <code><pre>
    % lsort -index -2 {{1 . c} {2 . b} {3 . a}}
    {3 . a} {2 . b} {1 . c}
    </pre></code>
    
    The main issue here is - TclGetIntForIndex can not distinguish between<br/> end?[+-]index? and integer?[+-]integer?.<br/>
    So by fixed length values like INDEX_END/SORTIDX_END it cannot be used properly.
    
    Rather we need still one command, like TclGetIntForIndexC which will return<br/> TCL_ERROR in case of result <= INDEX_END (usable for compiled only).<br/> 
    Or the byte-code of several commands should be rewritten to differentiate end?[+-]index? case.
    
    I assume both may be needed.
    
    I've one minimalistic fix for it as well as one own branch, where it is already correct implemented, will try to back-port it tomorrow to 8.6th.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"