Skip to content
Tcl Source Code History Of Ticket 1109484
Login

History Of Ticket 1109484

Artifacts Associated With Ticket 1109484

  1. Ticket change [08751861ad] (rid 89563) by hobbs on 2005-01-25 23:48:10:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The Tcl_Expr* functions in tclBasic.c do checks on the
      return value to see if it is int or double, but the
      value could be a wide int that fits into the requisite
      size.  That would prevent an error condition.  See this
      example from TclX:
      
      package require Tclx 8.4
      (Tcl) 57 % crange abc 1 {end-[expr 1]}
      b
      (Tcl) 58 % crange abc 1 {end-[expr wide(1)]}
      expression didn't have numeric value
      
      
    4. foundin initialized to: "obsolete: 8.4.9"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "hobbs"
    9. subsystem initialized to: "10. Objects"
    10. title initialized to: "Tcl_Expr* do not gracefully handle wide ints"
    11. type initialized to: "Bug"
  2. Ticket change [8a165452e3] (rid 127331) by hobbs on 2005-01-26 07:19:48:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      The following is just a teaser patch against core-8-4-branch
      that should be used in a few places to fix the issue:
      
      Index: generic/tclBasic.c
      ===================================================================
      RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
      retrieving revision 1.75.2.10
      diff -u -r1.75.2.10 tclBasic.c
      --- generic/tclBasic.c  29 Sep 2004 19:36:36 -0000     
      1.75.2.10
      +++ generic/tclBasic.c  26 Jan 2005 00:18:55 -0000
      @@ -4144,6 +4144,29 @@
                      *ptr = resultPtr->internalRep.longValue;
                  } else if (resultPtr->typePtr == &tclDoubleType) {
                      *ptr = (long)
      resultPtr->internalRep.doubleValue;
      +           } else if (resultPtr->typePtr == &tclWideIntType) {
      +#ifndef TCL_WIDE_INT_IS_LONG
      +               /*
      +                * If the object is already a wide integer,
      don't convert it.
      +                * This code allows for any integer in the
      range -ULONG_MAX to
      +                * ULONG_MAX to be converted to a long,
      ignoring overflow.
      +                * The rule preserves existing semantics for
      conversion of
      +                * integers on input, but avoids inadvertent
      demotion of
      +                * wide integers to 32-bit ones in the
      internal rep.
      +                */
      +
      +               Tcl_WideInt w =
      resultPtr->internalRep.wideValue;
      +               if (w >= -(Tcl_WideInt)(ULONG_MAX) && w <=
      (Tcl_WideInt)(ULONG_MAX)) {
      +                   *ptr = Tcl_WideAsLong(w);
      +               } else {
      +                   Tcl_SetResult(interp,
      +                           "integer value too large to
      represent as non-long integer",
      +                           TCL_STATIC);
      +                   result = TCL_ERROR;
      +               }
      +#else
      +               *ptr = resultPtr->internalRep.longValue;
      +#endif
                  } else {
                      Tcl_SetResult(interp,
                              "expression didn't have numeric
      value", TCL_STATIC);
      
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  3. Ticket change [698dcd35ca] (rid 103274) by hobbs on 2005-01-27 08:29:55:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      This patch reportedly fixed an issue someone was having with
      TclX, so apparently the problem can creep in in real-life
      code.  Any reason not to go with this solution?
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "hobbs"
  4. Ticket change [94f7c519bd] (rid 106088) by hobbs on 2005-01-28 08:51:16:

    1. closedate changed to: "2005-01-28T01:51:16"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      
      Fixed with attached patch in 8.5a3 head and 8.4 branch.
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "hobbs"
  5. Ticket change [cd4ff894c5] (rid 95868) by hobbs on 2005-01-28 08:51:17:

    1. icomment:
      
      
      File Added - 117468: 1109484.patch
      
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  6. Add attachment "1109484.patch" [50a09d3305] (rid 126005) by hobbs on 2005-01-28 08:51:17.

  7. Ticket change [fd2b9b0db2] (rid 108371) by dgp on 2005-01-28 11:37:42:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      I see a fix is now in place.
      
      Any chance we can also get some
      tests for this in the test suite?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [4a97864b24] (rid 126561) by dkf on 2005-01-28 20:38:58:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Added test (expr-old-37.2) in HEAD.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"