Skip to content
Tcl Source Code History Of Ticket 542588ffff
Login

History Of Ticket 542588ffff

Artifacts Associated With Ticket 542588ffff

  1. Ticket change [36fad5d780] (rid 107195) by nobody on 2002-04-11 18:05:34:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      % set begin 6658020034
      6658020034
      % set end   658020034
      658020034
      % expr abs($end - $begin)
      integer value too large to represent
      % expr { abs($end - $begin) }
      can't use floating-point value as operand of "-"
      % expr { abs(658020034 - 6658020034) }
      integer value too large to represent
       
      Can someone explain where Tcl thinks the floating
      point value is?  And why is a floating point value
      not a valid operand of "-"?
      
       - Phil Ehrens
       
      This is just an example of too much sharing of a
      common routine for producing an error message.
      
      There's one routine for generating the "illegal
      operand" error message, and by the time it is called,
      the context isn't around any more to tailor the
      message precisely. So the error message generator
      knows that "658020034" was "bad", and it can see that
      that is a legal floating-point value, so it assumes
      that the error is that a floating-point value was used
      where it should not be. Go ahead and file a bug report
      under the "ByteCode Compiler" Category.
      
      - Don Porter
      
    4. foundin initialized to: "obsolete: 8.3.4"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "47. Bytecode Compiler"
    10. title initialized to: "bug in expr error handler"
    11. type initialized to: "Bug"
  2. Ticket change [9c0dc8ba64] (rid 111217) by msofer on 2002-04-16 01:34:16:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that this particular example fails to produce the error
      in tcl8.5 (Donal's 64 bit arithmetic), but it can be
      reproduced by going beyong the 64-bit limit:
         set begin 665802003400000000000000
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [0c9b34b505] (rid 114207) by msofer on 2002-04-16 01:40:47:

    1. foundin changed to: "obsolete: 8.4a5"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that 'abs' has nothing to do with it
      
      % set begin 665802003400000000000000
      665802003400000000000000
      % expr $begin - 1
      integer value too large to represent
      % expr {$begin - 1}
      can't use floating-point value as operand of "-"
      
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  4. Ticket change [3f804a245a] (rid 121467) by msofer on 2002-04-16 22:45:01:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Related bug (the relationship is in the cause, not the symptom):
      
      % set begin 665802003400000000000000
      665802003400000000000000
      % expr {1 && $begin}
      1
      % expr 1 && $begin
      integer value too large to represent
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [96349b284c] (rid 106288) by msofer on 2002-04-17 05:41:27:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Another sibling is
      
      % set a 08
      08
      % expr $a+1
      "08" is an invalid octal number
      % expr {$a+1}
      can't use invalid octal number as operand of "+"
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [b8e348d5f2] (rid 129039) by msofer on 2002-04-17 05:46:01:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      More ...
      
      % set a 08
      08
      % expr abs($a)
      "08" is an invalid octal number
      % expr {abs($a)}
      argument to math function was an invalid octal number
      
      The error cases follow a different path, and produce
      different results.In this particular case, I like the second
      one better ...
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [cdbdf8bf59] (rid 95944) by andreas_kupries on 2002-04-17 05:47:21:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Why is that a sibling ?
      
      The leading 0 tells tcl to interpret 08 as an octal number, 
      but 8 is not a valid octal digit, Hence it is an invalid 
      octal number, and the message is essentially correct in 
      both cases. Or is the problem that the message is different 
      for the two cases ?
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  8. Ticket change [664ff39551] (rid 102690) by msofer on 2002-04-17 05:55:20:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Yes, in my mind (and in the evolving patch), the problem to
      fix is "both paths should produce the same error messages,
      but don't". All of these fall in *that* category, although
      some are less severe as they produce different but correct
      messages. Maybe it is not necessary to produce the same
      error message,as long as it is a correct one?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [4fb6e94264] (rid 125873) by andreas_kupries on 2002-04-17 05:58:50:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Ok. I also prefer that the path should produce the same 
      message. If that is not possible I am willing to settle for 
      different yet correct messages.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  10. Ticket change [abfa3db687] (rid 101209) by msofer on 2002-04-17 06:00:39:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Are these bugs too?
      
      % set a 08
      08
      % expr $a
      "08" is an invalid octal number
      % expr {$a}
      08
      % set b 665802003400000000000000
      665802003400000000000000
      % expr $b
      integer value too large to represent
      % expr {$b}
      665802003400000000000000
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [365512bd80] (rid 107092) by hobbs on 2002-04-17 06:03:28:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      No, those are being treated as normal strings.  That has 
      always been a behavior of expr.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  12. Ticket change [4383badb6d] (rid 116565) by msofer on 2002-04-17 19:58:53:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      According to expr.n:
      "If no numeric interpretation is possible, then an operand
      is left as a string (and only a limited set  of operators
      may be applied to it)."
      
      As I understand that, the following is indeed a bug:
      
      % set a 08
      08
      % expr $a
      "08" is an invalid octal number
      % expr 08
      "08" is an invalid octal number
      
      The source of misunderstanding is obviously in "no numeric
      representation is possible": tcl seems to say that "08" can
       be represented as a number, which happens to be invalid -
      I'd rather say that 08 cannot be represented as a number. 
      
      In the same vein, how should we interpret a string of digits
      that is too large to represent as an integer: "an integer
      too large to represent", or "a string that cannot be
      represented as a number"?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  13. Ticket change [86ebf83bbb] (rid 131600) by hobbs on 2002-04-18 02:40:48:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      I don't think you are reading the docs right (or they 
      aren't written clearly).  'expr foo' fails as well, but 
      expr {"foo"} and expr {"08"} are both OK.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  14. Ticket change [f00f84b5b8] (rid 109109) by nobody on 2002-04-18 02:46:51:

    1. icomment:
      Logged In: NO 
      
      Boy, if I went so far off-topic in one of my bug reports
      here I would be flayed alive.
      
      The problem, whatever caused it, is that the error message
      reported per my original bug report is wrong by anybody's
      measure of wrongness... except possibly Ariel Sharon,
      whose measure seems to have a directional component which
      makes it unreliable.
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  15. Ticket change [305c79afa1] (rid 93240) by msofer on 2002-04-18 02:57:31:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Indeed; the cause of the bug is that the error handler for
      operations in the bc engine (IllegalExprOperandType) assumes
      that it can only get empty strings, bad octals or (default)
      floating point values. So, a superficial fix just touches that.
      
      The issue that is worrying me is: is this really a "bad
      operand" issue, or should the error have been caught
      earlier? As there are two different execution paths for
      [expr] (braced vs unbraced), and they seem to behave
      differently ...
      
      Anyway, I'll fix the immediate issue and log a new bug
      report with the deeper one. Sorry for messing up the discussion.
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  16. Ticket change [8cfd59736d] (rid 127840) by hobbs on 2002-04-18 03:13:48:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      I believe the reason that the compiled object version fails 
      with a different message is that it will first try and get 
      it with GetIntFromObj, which fails.  It then tries 
      GetDoubleFromObj, which succeeds (because strtod has larger 
      range acceptance), but then fails as doubles (floats) 
      aren't accepted for abs.
      
      In the static case, it fails because it succeeds the 
      LooksLikeInt, which means it is either an acceptable int or 
      one too large to represent.
      
      Quite simple, no?
      
      In the first case, it's Tcl that sub's end and begin, not 
      the expr parser, so you get the too large int again.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  17. Ticket change [66d2dbd949] (rid 102792) by msofer on 2002-04-18 04:12:31:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      No, it never gets to 'abs'; note that it is '-' complaining
      about a non valid operand. Doubles are acceptable operands
      for 'abs'.
      
      Look at what is happening in INST_SUB: TclLooksLikeInt
      returns 1, so GetIntFromObj is called and it fails, so that
      IllegalExprOperandType gets called. GetDoubleFromObj is
      never called (it is called only when TclLooksLikeInt fails). 
      
      The problem is indeed that IllegalExprOperandType is not
      expecting to receive "too large integers". The local fix
      there will produce something like
      
      % expr { abs($end - $begin) }
      can't use integer value too large to represent as operand of
      "-" 
      
      The case
      
      % expr abs($end - $begin)
      integer value too large to represent 
      
      is caught earlier, before subtraction is ever attempted.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  18. Ticket change [05524a09d5] (rid 89038) by dkf on 2002-04-18 15:28:57:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Problem is really that GET_WIDE_OR_INT (really just
      Tcl_Get(Wide)IntFromObj) is failing due to integer range
      overflow, and the code as it stands does not check for that
      error case.  However, you can't always feed the value to
      parse into Tcl_GetDoubleFromObj when GET_WIDE_OR_INT fails
      due to things like invalid octal.  What's worse, the nature
      of the failure has vanished at this point because
      GET_WIDE_OR_INT does not use an interpreter, and
      Tcl_Get(Wide)IntFromObj resets errno...  :^(
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  19. Ticket change [70f4079c1d] (rid 100578) by msofer on 2002-04-18 19:43:46:

    1. icomment:
      
      
      File Added - 21448: bug542588-tcl8.3.patch
      
      Logged In: YES 
      user_id=148712
      
      Enclosing a patch for tcl8.3 sources that fixes the
      immediate issue.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  20. Add attachment "bug542588-tcl8.3.patch" [5306d43035] (rid 126411) by msofer on 2002-04-18 19:43:46.

  21. Add attachment "bug542588-tcl8.4.patch" [6ef9902805] (rid 100229) by msofer on 2002-04-18 21:01:20.

  22. Ticket change [bdfb2d5d8d] (rid 101997) by msofer on 2002-04-18 21:01:20:

    1. closedate changed to: "2002-04-18T14:01:20"
    2. closer changed to: "msofer"
    3. icomment:
      
      
      File Added - 21450: bug542588-tcl8.4.patch
      
      Logged In: YES 
      user_id=148712
      
      Patch for tcl8.4 attached; committed to both HEAD and
      core-8-3-1-branch.
      
      The initial issue is solved; bug report #545661 was opened
      for  the dependence of [expr]'s error handling on the timeof
      compilation.
      
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"