Itcl - the [incr Tcl] extension

Ticket Change Details
Login
Overview

Artifact ID: 4df7f05a7e5bcd9af08d3efd7d97e5fb3b1db5f6
Ticket: d07590ce7dd0138ce43bdf4b22df558948030186
segfault with tailcall and coroutines and Itcl method calls
User & Date: dgp 2015-05-22 15:36:11
Changes

  1. foundin changed to: "trunk"
  2. icomment:
    The other ticket was getting too many variants, and this
    one is a clean segfault:
    
    package require Itcl 4
    itcl::class juggler {
        variable name
        variable target
        constructor {_n _t} {
            set name $_n
            set target $_t
    
            ::proc toss args {
                tailcall my {*}[info level 0]
            }
        }
        method toss {{value ""}} {
            if {[llength [info level 0]] == 2} {
                set value [yield [info coroutine]]
            }
            if {$value ne ""} {
    puts "$name toss $value -- [namespace current]-[namespace which toss]"
                toss $value
            }
        }
    }
    
    coroutine j1 [juggler #auto Larry [
    coroutine j3 [juggler #auto Moe {}] toss ]] toss X
    
    
    Result:
    Larry toss X -- ::juggler-::juggler::
    make: *** [shell] Segmentation fault
    
    
    #0  0x000000000054f21b in TclPushProcCallFrame (clientData=0x8b3d00, 
        interp=0x81f6e0, objc=2, objv=0x96ed90, isLambda=0)
        at /home/dgp/fossil/tcl/generic/tclProc.c:1598
    #1  0x000000000054f40d in TclNRInterpProc (clientData=0x8b3d00, 
        interp=0x81f6e0, objc=2, objv=0x96ed90)
        at /home/dgp/fossil/tcl/generic/tclProc.c:1707
    #2  0x0000000000414c40 in Dispatch (data=0x869ee8, interp=0x81f6e0, result=0)
        at /home/dgp/fossil/tcl/generic/tclBasic.c:4360
    #3  0x0000000000414cce in TclNRRunCallbacks (interp=0x81f6e0, result=0, 
        rootPtr=0x0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4393
    #4  0x000000000041442e in Tcl_EvalObjv (interp=0x81f6e0, objc=5, 
        objv=0x82cfe0, flags=2097168)
        at /home/dgp/fossil/tcl/generic/tclBasic.c:4123
    #5  0x0000000000416be8 in TclEvalEx (interp=0x81f6e0, 
        script=0x87e780 "package require Itcl 4\n
    
    ....
    (gdb) print *procPtr->cmdPtr
    Cannot access memory at address 0x100000080
    
  3. login: "dgp"
  4. mimetype: "text/x-fossil-plain"
  5. severity changed to: "Critical"
  6. status changed to: "Open"
  7. title changed to:
    segfault with tailcall and coroutines and Itcl method calls
    
  8. type changed to: "Code_Defect"