From f5f116ff983872cb0da47325218d26f0348454f5 Mon Sep 17 00:00:00 2001 From: mig Date: Sat, 5 Jan 2013 00:15:19 +0000 Subject: Add an assertion that checks the stack depth under TCL_COMPILE_DEBUG *before* stack cleanup. It currently triggers at several spots in the testsuite! --- generic/tclExecute.c | 12 ++++++++++-- 1 file 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); \ -- cgit v0.12