Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b819343af3bbf3e0c0fd4eae3168077ce6e7a93d
Ticket: 2007198fffffffffffffffffffffffffffffffff
[continue] result incompat with Tcl 8.4 ?
User & Date: ferrieux on 2008-07-01 19:57:45
Changes

  1. icomment:
    Logged In: YES 
    user_id=496139
    Originator: NO
    
    OK got it now.
    The problem is that INST_END_CATCH is executed too late:
    In [catch {...} somevar], "somevar" is set *before* INST_END_CATCH.
    
    In my example: [catch {eval $ev;continue} y], I have verified this fact by single-stepping through TEBC.
    Full disassembly below. The interesting part is the sequence:
    
        (43) pushResult 
        (44) storeScalar1 %v1       # var "y"
        (46) pop 
        (47) pushReturnCode 
        (48) endCatch 
    
    As you can see, the ResetResult in endCatch comes after the pushResult/storeScalar !
    Notice that the example includes an [eval] in order to touch the interp's result.
    Indeed, [catch {set x 12;continue} y] skips the bug by simply not touching the result in the first place.
    While [catch {eval {set x 12};continue} y] correctly shows the misbehavior.
    
    I'd say the "one right place" is rather after the line
    
    if ((result == TCL_CONTINUE) || (result == TCL_BREAK)) {
    
    (a few lines below the processExceptionReturn: label).
    Do you agree ?
    
    
    FULL DISASS:
    
      Command 2: "catch {eval $ev;continue} y"
        (5) startCommand +44 1      # next cmd at pc 49
        (14) beginCatch4 0 
      Command 3: "eval $ev"
        (19) push1 1        # "eval"
        (21) loadScalar1 %v0        # var "ev"
        (23) invokeStk1 2 
        (25) pop 
      Command 4: "continue"
        (26) startCommand +10 1     # next cmd at pc 36
        (35) continue 
        (36) storeScalar1 %v1       # var "y"
        (38) pop 
        (39) push1 2        # "0"
        (41) jump1 +7       # pc 48
        (43) pushResult 
        (44) storeScalar1 %v1       # var "y"
        (46) pop 
        (47) pushReturnCode 
        (48) endCatch 
        (49) pop 
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"