summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-23 20:21:04 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-10-23 20:21:04 -0700
commit2ec7f6f24289a5b511edf35181d0178b1e94b0f3 (patch)
tree432c4b46efdac9dd1f93ae3da73041d503df79f6 /embed.h
parent4c3ed7418bcf4eae5235fb7bcae842820725bea8 (diff)
downloadperl-2ec7f6f24289a5b511edf35181d0178b1e94b0f3.tar.gz
[perl #119797] Fix if/else in lvalue sub
When if/else/unless is the last thing in an lvalue sub, the lvalue context is not always propagated properly and scope exit tries to copy things, including arrays, resulting in ‘Bizarre copy of ARRAY’. This commit fixes the bizarre copy by flagging any leave op that is part of an lvalue sub’s return sequence, using the OPpLEAVE flag added for this purpose in the previous commit. Then pp_leave uses that flag to avoid copying return values, but protects them via the mortals stack just like pp_leavesublv (actually pp_ctl.c:S_return_lvalues). For ‘if’ and ‘unless’ without ‘else’, the lvalue context was not being propagated, resulting in arrays’ getting flattened despite the lvalue context. op_lvalue_flags in op.c needed to handle AND and OR ops, which ‘if’ and ‘unless’ compile to, to make this work.
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/embed.h b/embed.h
index 00058f1e30..e0123067e1 100644
--- a/embed.h
+++ b/embed.h
@@ -1516,7 +1516,7 @@
#define refto(a) S_refto(aTHX_ a)
# endif
# if defined(PERL_IN_PP_CTL_C)
-#define adjust_stack_on_leave(a,b,c,d,e) S_adjust_stack_on_leave(aTHX_ a,b,c,d,e)
+#define adjust_stack_on_leave(a,b,c,d,e,f) S_adjust_stack_on_leave(aTHX_ a,b,c,d,e,f)
#define check_type_and_open(a) S_check_type_and_open(aTHX_ a)
#define destroy_matcher(a) S_destroy_matcher(aTHX_ a)
#define do_smartmatch(a,b,c) S_do_smartmatch(aTHX_ a,b,c)