| Ticket UUID: | 3614102 | ||
| Title: | stack imbalance panic from [list] | ||
| Type: | Bug | Created on: | 2013-05-29 15:43:56 |
| Submitter: | dgp | Assigned to: | dgp |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 5 Medium | Last modified: | 2013-05-30 00:20:55 |
| Status: | Closed | Closed by: | dgp |
| Resolution: | Fixed | Closed on: | 2013-05-29 17:20:55 |
| Version: | current: 8.6.0 | ||
| Description: | ||||
% proc foo {} {
list [append ::dgp a b c]
}
% foo
bad stack adjustment when compiling list (was 2 instead of 1)
| ||||
| User Comments: | ||||
dgp added on 2013-05-29 22:50:09:
Still investigating, but I think the trouble is that TclCompileScript() is failing to clean up the record of stack usage when a compileProc fails. dgp added on 2013-05-29 22:53:19:
8.6.0 release will not show the failure. The new [list] compiler is needed to demonstrate. I think it's exposing, rather than creating the flaw, though. dgp added on 2013-05-29 23:20:22:
Checkin [efa1b5bb6b] is where the debug panic starts. dgp added on 2013-05-29 23:22:22:
Oh, I missed that the "append multiple" compiler was new in that checkin too. dgp added on 2013-05-29 23:29:15:
Here's one that fails in 8.6.0:
% proc foo {} {
list [array exists ::foo(bar)]
}
% foo
bad stack adjustment when compiling list (was 3 instead of 1)
dgp added on 2013-05-29 23:32:31:
And strangely enough, that one is fixed on the trunk. dgp added on 2013-05-29 23:50:43:
But this one isn't:
% proc foo {} {
list [::tcl::array::exists ::foo(bar)]
}
% foo
bad stack adjustment when compiling list (was 2 instead of 1)
make: *** [shell] Aborted
dgp added on 2013-05-30 00:09:32:
...because CompileToCompiledCommand()
gets this right where TclCompileScript() fails.
Here's a stable test case I will commit:
test compile-19.0 {Bug 3614102: reset stack housekeeping} -body {
# This will panic in a --enable-symbols=compile build, unless bug is fixed.
apply {{} {list [if 1]}}
} -returnCodes error -match glob -result *
dgp added on 2013-05-30 00:20:55:
allow_comments - 1 fix committed. | ||||
