Skip to content
Tcl Source Code History Of Ticket 758110ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 758110ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 758110ffffffffffffffffffffffffffffffffff

  1. Ticket change [f7b0109757] (rid 91416) by hgiese on 2003-06-20 19:07:49:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Hello out there,
      the command
          dict info ""
      leads to a crash in my Borland generated Tcl 8.5a0 (on
      Win98).
      
      Here is what happens on my machine:
      - The first time around in DictInfoCmd the TclObj in
      question is not of
        type dictionary and so it gets converted via a call
      to SetDictFromAny.
      - Then the variable 'Dict *dict' is properly
      initialised. Inspecting it
        I see that its 'table' element has its element
      'numEntries' set to '0'
        - reasonable.
      - But then within Tcl_HashStats one calculates
          average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
        with tablePtr->numEntries being '0' -> BOOM.
      
      I would suggest the following change in function
      "Tcl_HashStats" (file
      tclHash.c):
      
      Put the line
              average +=
      (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
      into a conditional like
              /*
               * On machines not supporting "automatic NAN
      handling" or such, we
               * really should test for the denominator == 0
               */
              if ( tablePtr->numEntries )
                  average +=
      (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0;
      
      This will return a value of 0.0 for the average - which
      is maybe not
      exactly right but a reasonable value for an empty
      dictionary.
      
      Best regards
      Helmut Giese
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "hgiese"
    9. subsystem initialized to: "15. Dict Object"
    10. title initialized to: "patch for 'dict info {}'"
    11. type initialized to: "Patch"
  2. Ticket change [8e8db3eafa] (rid 120129) by dkf on 2003-06-23 22:07:30:

    1. subsystem changed to: "10. Objects"
  3. Ticket change [4771f1f173] (rid 99706) by dkf on 2003-06-23 22:07:31:

    1. priority changed to: "9 Immediate"
  4. Ticket change [0f697b36bc] (rid 94785) by nobody on 2003-06-23 22:51:26:

    1. icomment:
      Logged In: NO 
      
      Hi Donal,
      meanwhile I got some more information. It seems possible to
      turn off floating point exceptions, thus (maybe) getting a
      NAN result like you do on Windows, too - haven't tested it yet.
      This leads me to the question: How does it run on Windows
      without the above patch? Returns a NAN? Throws an exception?
      It could be that VC++ leaves (floating point) exceptions
      disabled (appears to be the default) and Borland does not,
      so a better patch might be to have Borland behave like VC -
      which would mean a different patch and would eliminate the
      need for the one above.
      
      Maybe let it rest for a couple of days, 'til I got time to
      further look into this.
      Best regards
      Helmut Giese
      
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  5. Ticket change [30c7640a67] (rid 93317) by dkf on 2003-06-25 02:59:05:

    1. closedate changed to: "2003-06-24T19:59:05"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      FP exceptions are a separate matter, but there's no real
      reason for that code to divide by zero in the first place.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"
  6. Ticket change [d0ace9cd30] (rid 113221) by hgiese on 2003-06-25 03:58:30:

    1. icomment:
      Logged In: YES 
      user_id=522169
      
      Hi Donal,
      I was almost ready to withdraw the patch: 
      1) I figured you were content of getting a NAN for 'avg'.
      2) Meanwhile I'm a bit further ahead on the way to Borland &
      Tcl Nirvana - I don't GP at this test, so it's not a ral
      issue for me anymore.
      Of course, if you think that any division by zero should be
      avoided - well, put in the conditional.
      For me, I consider this (tiny) issue closed - got bigger
      problems with Borland :(
      Best regards
      Helmut Giese
      
      
    2. login: "hgiese"
    3. mimetype: "text/plain"
    4. username: "hgiese"
  7. Ticket change [4f1c88ae43] (rid 125770) by dkf on 2003-06-25 15:18:55:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Bah.  There was just no need to ever divide by zero anyway
      in that code.  It had the feeling of a case never considered
      by the original author (and that code is one of the oldest
      parts of Tcl, dating from before the CVS archive.  IIRC, it
      was exactly like that in 7.4b1 which was the first version
      of Tcl I've ever looked at...)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"