Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d9d5f7e2a9122aca9dfae3dd03c6bd6e2231a57c
Ticket: 3154ea27591de16257a7b8b8d361514b004e527f
Repeat catch six times and get core dump
User & Date: dkf on 2016-05-07 19:59:16
Changes

  1. icomment:
    Looking at this code (rewritten to be a bit clearer about basic blocks):
    <pre>
            beginCatch @badLabel
            push error
            push testing
            invokeStk 2
            pop
            push 0
            jump @okLabel
    
            label @badLabel
            push 1; # should be pushReturnCode
            jump @okLabel
    
            label @okLabel
            endCatch
            pop
    </pre>
    Is it just me or does the code get to the <tt>endCatch</tt> with the exception stack in an inconsistent state? (The analyser doesn't know that <tt>error testing</tt> will always throw.) If the <tt>invokeStk</tt> doesn't throw, the jump to <tt>@okLabel</tt> will be done with exception stack having depth 1. If the <tt>invokeStk</tt> <i>does</i> throw, the implicit jump to <tt>@okLabel</tt> will be effectively done with exception stack having depth 0. Hence the crunch. This code ought to refuse to compile.
    <p>
    Assuming I'm analysing this all right.
    
  2. login: "dkf"
  3. mimetype: "text/html"
  4. username: "dkf"