Subject: Corrected the stack balancing in the special [list {*} ] compiler.

From: dkf <[email-masked]>
Date: Sun, 12 May 2013 00:42:53 +0000

---
 generic/tclCompile.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 838d801..7f6b7d4 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1879,6 +1879,13 @@ TclCompileScript(
 	if (parsePtr->numWords > 0) {
 	    int expand = 0;	/* Set if there are dynamic expansions to
 				 * handle */
+	    int expandIgnoredWords = 0;
+				/* The number of *apparent* words that we are
+				 * generating code from directly during
+				 * expansion processing. For [list {*}blah]
+				 * expansion, we set this to one because we
+				 * ignore the first word and generate code
+				 * directly. */
 
 	    /*
 	     * If not the first command, pop the previous command's result
@@ -2156,6 +2163,7 @@ TclCompileScript(
 			     */
 
 			    expand = INST_LIST_EXPANDED;
+			    expandIgnoredWords = 1;
 			    continue;
 			}
 		    }
@@ -2208,7 +2216,7 @@ TclCompileScript(
 		 */
 
 		TclEmitOpcode(expand, envPtr);
-		TclAdjustStackDepth((1-wordIdx), envPtr);
+		TclAdjustStackDepth(1 + expandIgnoredWords - wordIdx, envPtr);
 	    } else if (wordIdx > 0) {
 		/*
 		 * Save PC -> command map for the TclArgumentBC* functions.
-- 
cgit v0.12