summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-09-04 23:14:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-09-04 23:14:32 (GMT)
commite569b1fb491d02be089d87f32688368deb30ef12 (patch)
tree2df917c1cfc209588ea186d2bc808ada2ee78589 /generic
parent8b0b3531f3dd05e5a4fd6a5d144f83c7e6b28b07 (diff)
downloadtcl-e569b1fb491d02be089d87f32688368deb30ef12.zip
tcl-e569b1fb491d02be089d87f32688368deb30ef12.tar.gz
tcl-e569b1fb491d02be089d87f32688368deb30ef12.tar.bz2
Fixed up error in stack requirement estimation that made debug builds
panic during execution of [subst] bytecode.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c9b60dc..9b33b41 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.155 2009/09/04 21:07:18 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.156 2009/09/04 23:14:32 dgp Exp $
*/
#include "tclInt.h"
@@ -4063,6 +4063,16 @@ TclCompileSubstCmd(
TclEmitInstInt4(INST_REVERSE, 2, envPtr);
TclEmitOpcode(INST_POP, envPtr);
+ /*
+ * We've emitted several POP instructions, and the automatic
+ * computations for stack depth requirements have been decrementing
+ * for every one. However, we know that every branch actually taken
+ * only encounters some of those instructions. No branch passes
+ * through them all. So, we now have a stack requirements estimate
+ * that is too low. Here we manually fix that up.
+ */
+ TclAdjustStackDepth(5, envPtr);
+
/* OK destination */
if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) {
Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %d",