summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreask <andreask>2011-11-21 18:23:16 (GMT)
committerandreask <andreask>2011-11-21 18:23:16 (GMT)
commitdf6dfc34691563ae25dc7970f47e3b29c66c4dec (patch)
treef97dc0fb0ad7aafc48b91e4dd17ddc1c7dff34e6
parentd7d710f3ff4ee669067644f9e32149aabf6629a1 (diff)
downloadtcl-df6dfc34691563ae25dc7970f47e3b29c66c4dec.zip
tcl-df6dfc34691563ae25dc7970f47e3b29c66c4dec.tar.gz
tcl-df6dfc34691563ae25dc7970f47e3b29c66c4dec.tar.bz2
Fix a bug where global precompiled code (A) called from a precompiled
procedure causes the core to recompile (A), triggering the trap laid inside, i.e. 'error "called a copy of compiled code"'. <pre>Example ----------------------ex1.tcl proc init {} { source ex2.tcl } init ----------------------ex2.tcl puts a ----------------------</pre> When run as precompiled code the 'puts a' is not executed, only the trap. Fixed by enclosing the offending code into a guard which prevents its execution for precompiled code. The change passes the entire testsuite.
-rw-r--r--generic/tclExecute.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 953c63e..b7c576a 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1652,14 +1652,16 @@ TclCompileObj(
}
}
- if (codePtr->procPtr == NULL) {
- /*
- * Check that any compiled locals do refer to the current proc
- * environment! If not, recompile.
- */
+ if (!(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) {
+ if (codePtr->procPtr == NULL) {
+ /*
+ * Check that any compiled locals do refer to the current proc
+ * environment! If not, recompile.
+ */
- if (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr) {
- goto recompileObj;
+ if (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr) {
+ goto recompileObj;
+ }
}
}