summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormig <mig>2013-01-05 00:15:19 (GMT)
committermig <mig>2013-01-05 00:15:19 (GMT)
commitf5f116ff983872cb0da47325218d26f0348454f5 (patch)
tree48a6d80b3db92f678dd4f3082e5a5a35e112a0ad /generic
parenta2640e1242a6bda25202eb5d73b7cc6a5fa239ef (diff)
downloadtcl-f5f116ff983872cb0da47325218d26f0348454f5.zip
tcl-f5f116ff983872cb0da47325218d26f0348454f5.tar.gz
tcl-f5f116ff983872cb0da47325218d26f0348454f5.tar.bz2
Add an assertion that checks the stack depth under TCL_COMPILE_DEBUG *before* stack cleanup. It currently triggers at several spots in the testsuite!
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 3635bab..496bd9b 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -255,9 +255,16 @@ VarHashCreateVar(
* and within range.
*/
-#define NEXT_INST_F(pcAdjustment, nCleanup, resultHandling) \
+#if TCL_COMPILE_DEBUG
+#define CHECK_STACK() assert(CURR_DEPTH <= codePtr->maxStackDepth)
+#else
+#define CHECK_STACK()
+#endif
+
+#define NEXT_INST_F(pcAdjustment, nCleanup, resultHandling) \
do { \
TCL_CT_ASSERT((nCleanup >= 0) && (nCleanup <= 2)); \
+ CHECK_STACK(); \
if (nCleanup == 0) { \
if (resultHandling != 0) { \
if ((resultHandling) > 0) { \
@@ -286,7 +293,8 @@ VarHashCreateVar(
} \
} while (0)
-#define NEXT_INST_V(pcAdjustment, nCleanup, resultHandling) \
+#define NEXT_INST_V(pcAdjustment, nCleanup, resultHandling) \
+ CHECK_STACK(); \
do { \
pc += (pcAdjustment); \
cleanup = (nCleanup); \