Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dffda43b625e56e75cc8355b2682b033f1660917
Ticket: 96c3f3b47d13052efb84fefb9328a195f407d859
No processing of after events
User & Date: aspect on 2017-02-13 13:11:44
Changes

  1. icomment:
    So the underlying problem here is that Tcl_GetWideIntFromObj() produces a negative result for bignum values between WIDE_MAX+1 and UWIDE_MAX.  The manual seems pretty clear that it shouldn't, and I'm certain it breaks the expectations of callers elsewhere.  Straightforward to fix in itself, but nothing is simple ...
    
    Tcl_GetLongFromObj and even Tcl_GetIntFromObj are also affected:
    
    % testgetint [expr {1<<31}]
    -2147483648
    
    GLFO and GWIFO are not exposed to the test suite; they will need to be to shepherd this change in.
    
    mathfunc.n clearly states that wide() and int() truncate bitwise .. and at least ExprWideFunc relies on the cooperation of Tcl_GetWideIntFromObj's cooperation to do so:
    
    % expr {0 > int(1 << ($tcl_platform(wordSize)*8 - 1))}
    1
    
    
    I think mathfunc's contract is well-defined in the presence of negative bignums, but thinking about it is starting to hurt my head.
    
  2. login: "aspect"
  3. mimetype: "text/plain"