Skip to content
Tcl Source Code View Ticket
Login

View Ticket

coroutine + eval + locals = segfault

Closed / Fixed3282869fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-04-09 22:20:37
% proc f x {coroutine D eval {puts X$x;yield Y;puts Z}}
% f 12
Segmentation fault (core dumped)
ferrieuxplain2011-04-10 05:25:20
Looks like the compiled local x is broken in that case: varPtr is NULL in TEBCresume at

    case INST_LOAD_SCALAR1:
    instLoadScalar1:
opnd = TclGetUInt1AtPtr(pc+1);
varPtr = LOCAL(opnd);
msoferplain2011-04-11 06:19:49
The script to be evaled is somehow being compiled in f's context - iPtr->varFramePtr->localCachePtr points to f's. I have not yet found how or why.

Do note that

% proc f y {coroutine D eval {puts X$x;yield Y;puts Z}}
% f 12
can't read "x": no such variable
msoferplain2011-04-11 18:44:15
allow_comments - 1

fixed in trunk
Log in (anonymous is fine) to add a comment.