summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-03-16 17:00:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-03-16 17:00:39 (GMT)
commit4f1829bfd93b5dfb436ae65e02ee85b029d82315 (patch)
tree75fb38004e5dc2905a56c2f44af96a1b0ee2efff /generic
parent558f173d79314bd8f2c40124b6fdbd560f2196d6 (diff)
downloadtcl-4f1829bfd93b5dfb436ae65e02ee85b029d82315.zip
tcl-4f1829bfd93b5dfb436ae65e02ee85b029d82315.tar.gz
tcl-4f1829bfd93b5dfb436ae65e02ee85b029d82315.tar.bz2
Correct the handling of stack space calculation (the jump pattern used was
confusing the simple-minded code doing the calculations). [Bug 1903325]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index da97f08..9fa3bf6 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.142 2008/02/28 15:59:34 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.143 2008/03/16 17:00:43 dkf Exp $
*/
#include "tclInt.h"
@@ -814,7 +814,9 @@ TclCompileDictForCmd(
int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange;
int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset;
int numVars, endTargetOffset;
- int savedStackDepth = envPtr->currStackDepth; /* is this necessary? */
+ int savedStackDepth = envPtr->currStackDepth;
+ /* Needed because jumps confuse the stack
+ * space calculator. */
const char **argv;
Tcl_DString buffer;
@@ -921,9 +923,7 @@ TclCompileDictForCmd(
envPtr->line = mapPtr->loc[eclIndex].line[4];
CompileBody(envPtr, bodyTokenPtr, interp);
- envPtr->currStackDepth = savedStackDepth + 1;
TclEmitOpcode( INST_POP, envPtr);
- envPtr->currStackDepth = savedStackDepth;
/*
* Both exception target ranges (error and loop) end here.
@@ -977,6 +977,7 @@ TclCompileDictForCmd(
* easy!) Note that we skip the END_CATCH. [Bug 1382528]
*/
+ envPtr->currStackDepth = savedStackDepth+2;
jumpDisplacement = CurrentOffset(envPtr) - emptyTargetOffset;
TclUpdateInstInt4AtPc(INST_JUMP_TRUE4, jumpDisplacement,
envPtr->codeStart + emptyTargetOffset);