summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 67f450c252..1e4b1e9bf1 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1922,7 +1922,15 @@ PP(pp_enteriter)
else {
cx->blk_loop.lval_max_u.iterlval = newSVsv(sv);
(void) SvPV_force_nolen(cx->blk_loop.lval_max_u.iterlval);
+ /* This will do the upgrade to SVt_PV, and warn if the value
+ is uninitialised. */
(void) SvPV_nolen_const(right);
+ /* Doing this avoids a check every time in pp_iter in pp_hot.c
+ to replace !SvOK() with a pointer to "". */
+ if (!SvOK(right)) {
+ SvREFCNT_dec(right);
+ cx->blk_loop.ary_min_u.iterary = (AV*) &PL_sv_no;
+ }
}
}
else if (PL_op->op_private & OPpITER_REVERSED) {