From 0198d4b07964264dc869e7b3ec88e8b7fd25d18f Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 17 Feb 2010 15:59:24 +0000 Subject: Fix error in stack depth calculation for [dict update], correct misleading comment in description of opcode. --- ChangeLog | 10 ++++++++-- generic/tclCompCmds.c | 5 ++++- generic/tclCompile.c | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d0fad9..9a983fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,13 @@ +2010-02-17 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileDictUpdateCmd): Stack depth must be + correctly described when compiling a body to prevent crashes in some + debugging modes. + 2010-02-16 Jan Nijtmans - * generic/tclInt.h: Change order of various struct members, - restoring potential binary incompatibility with Tcl 8.5 + * generic/tclInt.h: Change order of various struct members, restoring + potential binary incompatibility with Tcl 8.5 2010-02-16 Donal K. Fellows diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index b9cf5f6..27b41a8 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.162 2010/02/13 18:11:05 dkf Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.163 2010/02/17 15:59:24 dkf Exp $ */ #include "tclInt.h" @@ -978,6 +978,7 @@ TclCompileDictUpdateCmd( const char *name; int i, nameChars, dictIndex, numVars, range, infoIndex; Tcl_Token **keyTokenPtrs, *dictVarTokenPtr, *bodyTokenPtr, *tokenPtr; + int savedStackDepth = envPtr->currStackDepth; DictUpdateInfo *duiPtr; JumpFixup jumpFixup; @@ -1095,7 +1096,9 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); + envPtr->currStackDepth++; CompileBody(envPtr, bodyTokenPtr, interp); + envPtr->currStackDepth = savedStackDepth; ExceptionRangeEnds(envPtr, range); /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 726aefb..acc667c 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.180 2010/01/30 16:33:25 dkf Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.181 2010/02/17 15:59:24 dkf Exp $ */ #include "tclInt.h" @@ -355,9 +355,9 @@ InstructionDesc const tclInstructionTable[] = { /* Create the variables (described in the aux data referred to by the * second immediate argument) to mirror the state of the dictionary in * the variable referred to by the first immediate argument. The list - * of keys (popped from the stack) must be the same length as the list - * of variables. - * Stack: ... keyList => ... */ + * of keys (top of the stack, not poppsed) must be the same length as + * the list of variables. + * Stack: ... keyList => ... keyList */ {"dictUpdateEnd", 9, -1, 2, {OPERAND_LVT4, OPERAND_AUX4}}, /* Reflect the state of local variables (described in the aux data * referred to by the second immediate argument) back to the state of -- cgit v0.12