Subject: Partial fix: still ongoing

From: dkf <[email-masked]>
Date: Sat, 11 May 2013 20:02:43 +0000

---
 generic/tclCompCmds.c | 3 +++
 generic/tclCompile.c  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 9ffdbc3..c2495bd 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -5761,6 +5761,7 @@ TclCompileReturnCmd(
 
 	    Tcl_DecrRefCount(returnOpts);
 	    TclEmitOpcode(INST_DONE, envPtr);
+	    envPtr->currStackDepth = savedStackDepth;
 	    return TCL_OK;
 	}
     }
@@ -5778,6 +5779,7 @@ TclCompileReturnCmd(
      */
 
     CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts);
+    envPtr->currStackDepth = savedStackDepth + 1;
     return TCL_OK;
 
   issueRuntimeReturn:
@@ -5807,6 +5809,7 @@ TclCompileReturnCmd(
      */
 
     TclEmitOpcode(INST_RETURN_STK, envPtr);
+    envPtr->currStackDepth = savedStackDepth + 1;
     return TCL_OK;
 }
 
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 1da6e03..838d801 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1434,7 +1434,7 @@ TclInitCompileEnv(
 {
     Interp *iPtr = (Interp *) interp;
 
-    assert(tclInstructionTable[LAST_INST_OPCODE].name == NULL);
+    assert(tclInstructionTable[LAST_INST_OPCODE+1].name == NULL);
 
     envPtr->iPtr = iPtr;
     envPtr->source = stringPtr;
-- 
cgit v0.12