From: Nicholas Clark Date: Thu, 24 Jan 2008 12:15:43 +0000 (+0000) Subject: Avoid using cx->blk_loop.itermax when reverse iterating an array. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b73ab1881b775e12ace39efe757716ab526e9db;p=p5sagit%2Fp5-mst-13.2.git Avoid using cx->blk_loop.itermax when reverse iterating an array. p4raw-id: //depot/perl@33060 --- diff --git a/pp_ctl.c b/pp_ctl.c index c857916..c0f0724 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1918,7 +1918,7 @@ PP(pp_enteriter) } } else if (PL_op->op_private & OPpITER_REVERSED) { - cx->blk_loop.itermax = 0; + cx->blk_loop.itermax = 0xDEADBEEF; cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary) + 1; } diff --git a/pp_hot.c b/pp_hot.c index 14a3e08..a7657f8 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1976,7 +1976,8 @@ PP(pp_iter) /* iterate array */ if (PL_op->op_private & OPpITER_REVERSED) { /* In reverse, use itermax as the min :-) */ - if (cx->blk_loop.iterix <= cx->blk_loop.itermax) + if (cx->blk_loop.iterix <= (CxTYPE(cx) == CXt_LOOP_STACK + ? cx->blk_loop.itermax : 0)) RETPUSHNO; if (SvMAGICAL(av) || AvREIFY(av)) {