From e569b1fb491d02be089d87f32688368deb30ef12 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 4 Sep 2009 23:14:32 +0000 Subject: Fixed up error in stack requirement estimation that made debug builds panic during execution of [subst] bytecode. --- generic/tclCompCmds.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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", -- cgit v0.12