Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-05-30
00:20 • Closed ticket [3614102fff]: stack imbalance panic from list plus 8 other c... artifact: c684633e6a user: dgp
00:09 • Ticket [3614102fff]: 4 changes artifact: 32359d6679 user: dgp
2013-05-29
23:50 • Ticket [3614102fff]: 4 changes artifact: 79b4a1591c user: dgp
23:32 • Ticket [3614102fff]: 4 changes artifact: 64fae2758b user: dgp
23:29 • Ticket [3614102fff]: 4 changes artifact: 98bebdf5cc user: dgp
23:22 • Ticket [3614102fff]: 4 changes artifact: 097af7002f user: dgp
23:20 • Ticket [3614102fff]: 4 changes artifact: 2c8d1643b9 user: dgp
22:53 • Ticket [3614102fff]: 4 changes artifact: e9068605c8 user: dgp
22:50 • Ticket [3614102fff]: 4 changes artifact: f24a9fb828 user: dgp
15:43 • New ticket [3614102fff]. artifact: cb0d059923 user: dgp

stack imbalance panic from [list]

Closed / Fixed3614102fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2013-05-29 15:43:56
% proc foo {} {
list [append ::dgp a b c]
}
% foo
bad stack adjustment when compiling list (was 2 instead of 1)
dgpplain2013-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.
dgpplain2013-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.
dgpplain2013-05-29 23:20:22
Checkin [efa1b5bb6b] is where the debug panic
starts.
dgpplain2013-05-29 23:22:22
Oh, I missed that the "append multiple" compiler
was new in that checkin too.
dgpplain2013-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)
dgpplain2013-05-29 23:32:31
And strangely enough, that one is fixed
on the trunk.
dgpplain2013-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
dgpplain2013-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 *
dgpplain2013-05-30 00:20:55
allow_comments - 1

fix committed.
Log in (anonymous is fine) to add a comment.