summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authormig <mig>2013-01-05 00:15:19 (GMT)
committermig <mig>2013-01-05 00:15:19 (GMT)
commit9b6ebeae02e4b5c0137af8852dbb78b683ace7b3 (patch)
tree48a6d80b3db92f678dd4f3082e5a5a35e112a0ad /generic/tclExecute.c
parent5bce11a1c8af32ec84672904b8cba0f99aa40592 (diff)
downloadtcl-9b6ebeae02e4b5c0137af8852dbb78b683ace7b3.zip
tcl-9b6ebeae02e4b5c0137af8852dbb78b683ace7b3.tar.gz
tcl-9b6ebeae02e4b5c0137af8852dbb78b683ace7b3.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/tclExecute.c')
-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); \