Skip to content
Tcl Source Code History Of Ticket 613117ffffffffff
Login

History Of Ticket 613117ffffffffff

Artifacts Associated With Ticket 613117ffffffffff

  1. Ticket change [f4a39f00b9] (rid 129953) by jkbonfield on 2002-09-23 08:50:13:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The following script produces an incorrect output
      ("ld" instead of "150" for the last line) when run on a
      Compaq personal workstation 433au (Alpha processor) 
      running Digital Unix 4.0E. My window manager is afterstep.
      
      set tk_strictMotif 1
      tk_getOpenFile; #then hit cancel
      puts [expr {double(150)/100}]
      puts [expr 150]
      
      I'm currently trying to analyse the bug with purify on Solaris 
      and memdebug on the alpha. I'll post any suitable debug 
      info here.
      
      
    4. foundin initialized to: "obsolete: 8.4.0"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "jkbonfield"
    9. subsystem initialized to: "42. Memory Preservation"
    10. title initialized to: "Memory corruption (in expr?)"
    11. type initialized to: "Bug"
  2. Ticket change [7fc0a6593f] (rid 97612) by jkbonfield on 2002-09-23 16:36:54:

    1. icomment:
      Logged In: YES 
      user_id=154581
      
      I've now tried this with --enable-memdebug on the Alpha 
      system. It triggers no response (assuming I'm using it 
      correctly):
      
      % bash$ /tmp/ins/bin/tclsh8.4 
      % package require Tk
      8.4
      % memory validate on
      % set tk_strictMotif 1
      1
      % tk_getOpenFile
      % puts [expr {double(150)/100}] 
      1.5
      % puts [expr 150] 
      ld
      % 
      
      I've also now built it on Solaris 8 using -DPURIFY and tested 
      under purify. This greatly reduces the number of warnings to 
      just a few dlopen issues (which are probably false).
      
      
    2. login: "jkbonfield"
    3. mimetype: "text/plain"
    4. username: "jkbonfield"
  3. Ticket change [c7b5ca70a1] (rid 121985) by jkbonfield on 2002-09-23 17:42:02:

    1. icomment:
      Logged In: YES 
      user_id=154581
      
      Now I'm getting somewhere. Still no useful debug output from 
      the memory checkers (which may imply an algorithmic bug?), 
      but I can replace the tk_getOpenFile with a one line procedure 
      calling grid. It has to be a procedure. The -minsize parameter 
      in the grid is the number which becomes cached incorrectly. Eg:
      
      package require Tk 
      proc bug {} { 
          grid columnconfig . 0 -minsize 10 
      } 
      bug 
      puts [expr {double(10)}] 
      puts [expr 10] 
      exit 
      
      Fortunately this is now sufficiently short to start low level 
      debugging...
      
      
    2. login: "jkbonfield"
    3. mimetype: "text/plain"
    4. username: "jkbonfield"
  4. Ticket change [640d3947f0] (rid 92686) by jkbonfield on 2002-09-23 23:24:32:

    1. icomment:
      Logged In: YES 
      user_id=154581
      
      It's not a memory corruption, but a sprintf format bug. The
      TCL_LL_MODIFIER gets set to ll, which leads to a sprintf of 
      %lld and this in turn leads to printing up of "ld" (as Digital Unix 
      does not support this,  and neither does it support lltostr).
      
      Digital Unix, running on an Alpha, has long as 64bits. %d is for 
      32-bit integers and %ld for l64-bit longs. This is the nice and 
      easy case, which other OSes have broken away from with 
      their long long hacks. I need to figure out why the automatic 
      type detection in tcl.h is chosing the wrong macro, but once 
      I've done that I'll submit a patch for testing (I cannot test it on 
      linux/alpha).
      
      What I cannot figure out from all this is quite how come this 
      bug required the black magic invocations I listed at the start to 
      trigger it. Clearly calling double(150) causes a 64-bit version 
      of the number and a removal of the string-format copy, but I 
      cannot see why this is dependant on 150 being used in an 
      argument to grid! Anyway, I'm pleased to finally get 
      somewhere with this rather bizarre bug!
      
      James
      
      
      
    2. login: "jkbonfield"
    3. mimetype: "text/plain"
    4. username: "jkbonfield"
  5. Ticket change [7556d29e2e] (rid 105374) by hobbs on 2002-09-23 23:43:31:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      Good analysis.  Forwarding to dkf to fix (his code changes 
      IIRC).
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. priority changed to: "6"
    6. username: "hobbs"
  6. Ticket change [191ad05479] (rid 122765) by jkbonfield on 2002-09-23 23:53:55:

    1. icomment:
      Logged In: YES 
      user_id=154581
      
      Ok I said I'd produce a patch, but I think I'm going to break 
      things royally if I try!
      
      I see that the correct Makefile defines to get things working 
      for me are -DTCL_WIDE_INT_TYPE_IS_LONG 
      -DTCL_WIDE_INT=long. In addition to this we need to add a 
      definition of TCL_LL_MODIFIER to be "l" for this case. The 
      code looks incomplete and when TCL_WIDE_INT_TYPE is 
      indeed long this never gets defined. Eg as an (incomplete) 
      patch:
      
      *** tcl.h~      Wed Sep 18 15:54:35 2002
      --- tcl.h       Mon Sep 23 17:45:20 2002
      ***************
      *** 401,406 ****
      --- 401,407 ----
        #   define Tcl_LongAsWide(val)                ((long)(val))
        #   define Tcl_WideAsDouble(val)      ((double)((long)(val)))
        #   define Tcl_DoubleAsWide(val)      ((long)((double)(val)))
      + #   define TCL_LL_MODIFIER            "l"
        #else /* TCL_WIDE_INT_IS_LONG */
        #   ifndef __WIN32__
        #      ifdef HAVE_STRUCT_STAT64
      
      How to define TCL_WIDE_INT_IS_LONG? Looks like tcl.m4 
      and the SC_TCL_64BIT_FLAGS macro. This is where I start 
      failing, not having enough knowledge of autoconf. I think an 
      AC_TRY run of "int main() {exit(sizeof(long)==8);}" may 
      suffice, but I'm not certain.
      
      
      
    2. login: "jkbonfield"
    3. mimetype: "text/plain"
    4. username: "jkbonfield"
  7. Ticket change [1604d8617c] (rid 124657) by techentin on 2002-09-24 03:50:23:

    1. icomment:
      Logged In: YES 
      user_id=43494
      
      For what it is worth, I can reproduce this bug on our alpha 
      running OSF1 v4.0.  But I also get a number of test suite 
      failures, where some numeric value is expected, but the 
      string "ld" is returned.  Like this:
      
      ==== expr-15.12 ExprCallMathFunc: call registered math 
      function FAILED
      ==== Contents of test case:
      
          expr T3(21, wide(37))
      
      ---- Result was:
      ld
      ---- Result should have been (exact matching):
      37
      ==== expr-15.12 FAILED
      
      
      Apparently related tests failing (for me) are for binary scan, 
      expr, format, scan, interp and slave recursion limits, tell, file 
      size, and string is integer/double.  I can send a list, if that is 
      helpful.
      
      
      
    2. login: "techentin"
    3. mimetype: "text/plain"
    4. username: "techentin"
  8. Ticket change [427b781217] (rid 116391) by pspjuth on 2002-09-24 04:33:47:

    1. icomment:
      Logged In: YES 
      user_id=98900
      
      Looks like a case of object shimmering in
      shared literals.
      
      I 
      extended the script with some debug info to
      see what's going on. 
      ([info objtype] is something
      in my debug version that prints the 
      internal object
      type):
      
      proc bug {} { 
          grid columnconfig . 0 -
      minsize 10 
      } 
      
      proc main {} {
          puts "Before bug: [info objtype 
      10]"
          bug 
          puts "After bug: [info objtype 10]"
          puts [expr 
      {double(10)}] 
          puts "After double: [info objtype 10]"
          puts [expr 10] 
      
          puts "After expr: [info objtype 10]"
      }
      
      proc main2 {} {
          puts 
      "\nWithout bug: [info objtype 11]"
          puts [expr {double(11)}] 
          puts 
      "After double: [info objtype 11]"
          puts [expr 11] 
          puts "After expr: 
      [info objtype 11]"
      }
      
      main
      main2
      
      
      Before bug: 
      int
      After bug: pixel
      10.0
      After double: wideInt
      10
      After 
      expr: wideInt
      
      Without bug: int
      11.0
      After double: 
      int
      11
      After expr: int
      
      
      Grid turns the literal into a "pixel" 
      object and
      then it seems double() has a preference for 
      "wideInt"
      when faced with something that isn't an "int",
      which 
      may or may not be considered a bug.
      It sure is a bug though that wide 
      integers don't
      work properly on your platform, but this shows 
      why
      it triggers the bug in that strange case.
      
      Does this also 
      trigger the bug?
      puts [expr wide(10)]
      
      
      
    2. login: "pspjuth"
    3. mimetype: "text/plain"
    4. username: "pspjuth"
  9. Ticket change [ceaf15b5a7] (rid 96096) by dkf on 2002-09-24 15:47:14:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Definitely sounds like something has come unstuck, probably
      in configure.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. subsystem changed to: "53. Configuration and Build Tools"
    6. username: "dkf"
  10. Ticket change [489b70a958] (rid 99920) by dkf on 2002-09-24 15:59:19:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Does the following produce the wrong output?
      puts [expr wide(5+5)]
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [121e9b5213] (rid 95258) by dkf on 2002-09-24 16:04:34:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The correct thing to do is to define TCL_WIDE_INT_IS_LONG on
      all AXP-based platforms. Why is this not happening here?
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  12. Ticket change [d370d69361] (rid 123288) by dkf on 2002-09-24 16:12:30:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      D'oh!  Stupid error on my part that just happened to work on
      some platforms.  TCL_WIDE_INT_IS_LONG was never being
      defined in tcl.m4, contrary to documentation and
      expectation...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  13. Ticket change [a12cc13ce2] (rid 109672) by dkf on 2002-09-24 16:31:09:

    1. closedate changed to: "2002-09-24T09:31:09"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      I believe this is fixed in CVS now; please reopen if that's
      not the case.
      
      Fix was to add AC_DEFINE(TCL_WIDE_INT_IS_LONG) to tcl.m4 a
      couple of lines before the place where TCL_WIDE_INT_TYPE is
      defined (it should be fairly easy to spot) and regenerate
      configure (for those people who don't just want to synch
      with the HEAD.)
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"
  14. Ticket change [7eafa16cdd] (rid 97458) by jkbonfield on 2002-09-24 20:34:28:

    1. closedate changed to: "2002-09-24T13:34:28"
    2. closer changed to: "jkbonfield"
    3. icomment:
      Logged In: YES 
      user_id=154581
      
      The CVS change fixes this for gcc, but not for the native cc. 
      This appears to pick __int64 as the data type and hence 
      starts using %lld again.
      
      Would it be sensible to do the long == 64bits check as the first 
      test as this then enables lots of code to be ifdefed out (so 
      should take priority over using an alternative type).
      
      
    4. login: "jkbonfield"
    5. mimetype: "text/plain"
    6. username: "jkbonfield"
  15. Ticket change [17ea72fa38] (rid 122577) by dkf on 2002-09-24 21:29:42:

    1. closedate changed to: "2002-09-24T14:29:42"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      OK, I think I've got it cracked now.  (You've got one mighty
      strange compiler, there!)
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. status changed to: "Pending"
    7. username: "dkf"
  16. Ticket change [9517c49afb] (rid 106104) by techentin on 2002-09-25 05:20:42:

    1. icomment:
      Logged In: YES 
      user_id=43494
      
      The latest CVS head now works fine on my system.  Only 
      bug left seems to be bug 574573
      
      
    2. login: "techentin"
    3. mimetype: "text/plain"
    4. username: "techentin"
  17. Ticket change [073796a5ff] (rid 89350) by jkbonfield on 2002-09-25 15:39:40:

    1. icomment:
      Logged In: YES 
      user_id=154581
      
      The configure script seems to work for me now with both DEC cc 
      and GNU gcc. Thanks Donal.
      
      
      
    2. login: "jkbonfield"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "jkbonfield"
  18. Ticket change [ca1ce1cbac] (rid 122404) by dkf on 2002-09-25 15:52:48:

    1. closedate changed to: "2002-09-25T08:52:48"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      Cool.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "dkf"