Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1384f2aa79f067eeee29d1d9204fa6efe47f8af9
Ticket: 2152286fffffffffffffffffffffffffffffffff
TCL_RETURN causes TclUpdateReturnInfo() to panic
User & Date: fadib on 2008-10-07 22:39:05
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Please see the attached testcase (tcltest.tar.gz)
    
    Problem Analysis:
    ----------------
    The problem happens when a C function calls a TCL proc that calls a C function that returns TCL_RETURN, this causes returnLevel to be decremented all the way to 0 causing TclUpdateReturnInfo() to panic.
    
    Testcase:
    --------
     + (tcltest.c): main() calls CProcCmd() function which is a C function with a TCL wrapper.
     + CProcCmd() calls tclproc (tcltest.tcl) which calls CProcCmd() again.
     + CProcCmd() returns TCL_RETURN which makes TCL panic.
    
    Workarounds:
    -----------
    There are two workarounds that I can use to make the testcase work (uncomment either line 25 or 28 in tcltest.c):
    
    + Workaround 1 (line 25): 
    Explicitly increment returnLevel before returning TCL_RETURN.
    
    + Workaround 2 (line 28): 
    Call a dummy tcl proc before returning TCL_RETURN. This works because it forces the returllevel to be incremented once and thus stops it from ever reaching 0.
    
    
    
  4. foundin changed to: "obsolete: 8.5.4"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "fadib"
  10. subsystem changed to: "45. Parsing and Eval"
  11. title changed to: "TCL_RETURN causes TclUpdateReturnInfo() to panic"
  12. type changed to: "Bug"