summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-22 12:14:28 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-22 12:15:02 -0700
commit862b2c434beb1d61a19037a8449c8db953fd37a0 (patch)
treea9ccda6228a7cac23655f8e6666e86676557b7a4 /pp_ctl.c
parent40914f83eabd350b52615a215aeb2704f7332495 (diff)
downloadperl-862b2c434beb1d61a19037a8449c8db953fd37a0.tar.gz
Call get-magic on temp returned under recursion
This fixes a regression introduced in 5.15.0. Commit 767eda44 made autovivification work with scalars returned from lvalue subs. In doing so, as it made entersub an autovivifying op, it had to add SvGETMAGIC calls to pp_return and pp_leavesub. (See 767eda44’s commit message for details.) In one spot in pp_return, the SvGETMAGIC call was added to the wrong branch of an if/else con- dition, causing a regression. Explicitly returning from a recursive subroutine call in autovivifying context would not call get-magic on the returned value.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 533ff5f33a..7f4371f701 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2499,13 +2499,13 @@ PP(pp_return)
*++newsp = SvREFCNT_inc(*SP);
FREETMPS;
sv_2mortal(*newsp);
+ if (gmagic) SvGETMAGIC(*newsp);
}
else {
sv = SvREFCNT_inc(*SP); /* FREETMPS could clobber it */
FREETMPS;
*++newsp = sv_mortalcopy(sv);
SvREFCNT_dec(sv);
- if (gmagic) SvGETMAGIC(sv);
}
}
else if (SvTEMP(*SP) && SvREFCNT(*SP) == 1) {