This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #8611] tied handles and gotos don't mix
authorDavid Mitchell <davem@iabyn.com>
Tue, 14 Jun 2011 13:21:56 +0000 (14:21 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 14 Jun 2011 13:31:35 +0000 (14:31 +0100)
commitd8ef3a16edf6875955d642f8f57ad55bddac9c71
tree558f14e3cef2a3a212dd69e43330867a55f39032
parenta2a7e1732d227dd914f1a6e647809f4180de0b83
[perl #8611] tied handles and gotos don't mix

tied handle method calls, unlike other types of tie, don't push a new
stack. This means that a goto within a method to an outer scope
"succeeds", and pops back the context stack past the method call. When
control (at the C level) eventually passes back to the return from
call_method(), we've lost all our relevant stack contents (like all the
ENTERs), and corruption ensures.

The fix is to add PUSHSTACKi/POPSTACK.

The side effect of this is that attempts to goto out of a tied handle
method call now give "Can't find label" errors, like non-handle methods
already do.
pp_sys.c
t/op/tie.t