Tcl Source Code

View Ticket
Login
Ticket UUID: 3047235
Title: non-bc'ed catch and tailcall
Type: Bug Version: obsolete: 8.6b1.1
Submitter: msofer Created on: 2010-08-17 20:13:22
Subsystem: 60. NRE and coroutines Assigned To: msofer
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2010-08-19 05:34:10
Resolution: Fixed Closed By: msofer
    Closed on: 2010-08-18 22:34:10
Description:
[Moved from 3046594]

You cannot [tailcall] out of a catch-environment. Bytecompiled [catch] is working properly and tested (tailcall-12.3a/b), non-bytecompiled [catch] is neither and segfaults:

% proc foo {} {set catch catch; $catch {tailcall concat}}
% foo

Program received signal SIGSEGV, Segmentation fault.
User Comments: msofer added on 2010-08-19 05:34:10:

allow_comments - 1

New redesign committed: [tailcall] errors out early, the command info is logged by the usual means.

msofer added on 2010-08-19 01:18:46:

allow_comments - 0

Missing Tcl_LogCommandInfo ... back to the drawing board

msofer added on 2010-08-19 00:51:25:
Fishy:

% proc foo {} {set catch catch; list [$catch {tailcall concat} msg] $msg}
% foo
1 {tailcall called from within a catch environment}
% set errorInfo
can't read "errorInfo": no such variable

dgp added on 2010-08-18 23:56:16:
confirm no crash, but either it or my expectation are
still not right:

% proc foo {} {set catch catch; $catch {tailcall concat}}
% foo
1
% set errorInfo
can't read "errorInfo": no such variable

What error is [catch] catching here?  And
how can we programmatically get a hold of it?

msofer added on 2010-08-18 23:40:41:
Tailcall should never be able to escape a catch context. Please try it (and commit a test?).

ferrieux added on 2010-08-18 23:32:37:
Now does it mean that a 'tailcall tailcall tailcall' could pop back 3 levels under the nose of a [catch] in the caller's context, without being caught ?

msofer added on 2010-08-18 22:47:54:

allow_comments - 1

msofer added on 2010-08-18 22:47:53:
Fixed in HEAD by redsigning (and simplifying) tailcall

msofer added on 2010-08-18 06:46:02:

File Added - 383752: diff

msofer added on 2010-08-18 06:45:29:
Attached patch fixes this issue, but new test tailcall-12.3c reveal something strange is still amiss.

Attachments: