This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #37725] perl segfaults on reversed array reference
[perl5.git] / pp_hot.c
index 312eef7..173aca2 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1899,11 +1899,11 @@ PP(pp_iter)
            RETPUSHNO;
 
        if (SvMAGICAL(av) || AvREIFY(av)) {
-           SV ** const svp = av_fetch(av, cx->blk_loop.iterix--, FALSE);
+           SV ** const svp = av_fetch(av, --cx->blk_loop.iterix, FALSE);
            sv = svp ? *svp : Nullsv;
        }
        else {
-           sv = AvARRAY(av)[cx->blk_loop.iterix--];
+           sv = AvARRAY(av)[--cx->blk_loop.iterix];
        }
     }
     else {