diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-09-20 01:34:31 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-09-20 12:44:39 -0700 |
commit | 0c0c317c3b754aee8ee3ef271d17aab2fdbe5140 (patch) | |
tree | 93c4ddd53821b00ca7ab91058743a48e7dcea88d /pp_ctl.c | |
parent | 7497b91fbd38419c3d11a21866233566db7a3c10 (diff) | |
download | perl-0c0c317c3b754aee8ee3ef271d17aab2fdbe5140.tar.gz |
[perl #3112] Stop last from returning values
In push @a, last, it can try to return the @a, copying it like a sca-
lar in the process, resulting in Bizarre copy of ARRAY in last.
In do{{&{sub{"Just another Perl hacker,\n"}},last}}, it returns "Just
another Perl hacker,\n".
The former is clearly a bug. The latter depends on a side-effect of
the same bug.
‘last’ really should not be trying to return the values that the same
statement has accumulated so far.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -2616,7 +2616,6 @@ PP(pp_last) POPBLOCK(cx,newpm); cxstack_ix++; /* temporarily protect top context */ - mark = newsp; switch (CxTYPE(cx)) { case CXt_LOOP_LAZYIV: case CXt_LOOP_LAZYSV: @@ -2643,8 +2642,7 @@ PP(pp_last) } TAINT_NOT; - PL_stack_sp = adjust_stack_on_leave(newsp, PL_stack_sp, MARK, gimme, - pop2 == CXt_SUB ? SVs_TEMP : 0); + PL_stack_sp = newsp; LEAVE; cxstack_ix--; |