This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix cx_dup for CXt_LOOP_PLAIN
authorDavid Mitchell <davem@iabyn.com>
Sun, 3 Jan 2016 15:17:40 +0000 (15:17 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:19:21 +0000 (09:19 +0000)
The context stack duplication code tries to duplicate the loop var
even for CXt_LOOP_PLAIN, which doesn't have a loop var. This didn't
use to matter, since PUSHLOOP_PLAIN() used to set the field to NULL;
for efficiency its now left untouched. So don't try to use it.

Also update the debugging context names since the ordering of the
CXt_LOOP_* has changed recently.

perl.h
sv.c

diff --git a/perl.h b/perl.h
index 2117e49..c60aeef 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -5110,11 +5110,11 @@ EXTCONST char* const PL_block_type[] = {
        "WHEN",
        "BLOCK",
        "GIVEN",
-       "LOOP_PLAIN",
-       "LOOP_LAZYIV",
+       "LOOP_ARY",
        "LOOP_LAZYSV",
+       "LOOP_LAZYIV",
        "LOOP_LIST",
-       "LOOP_ARY",
+       "LOOP_PLAIN",
        "SUB",
        "FORMAT",
        "EVAL",
diff --git a/sv.c b/sv.c
index d0400bb..f2736b7 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -14007,8 +14007,7 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
                 /* FALLTHROUGH */
            case CXt_LOOP_LIST:
            case CXt_LOOP_LAZYIV:
-           case CXt_LOOP_PLAIN:
-                /* code common to all CXt_LOOP_* types */
+                /* code common to all 'for' CXt_LOOP_* types */
                ncx->blk_loop.itersave =
                                     sv_dup_inc(ncx->blk_loop.itersave, param);
                if (CxPADLOOP(ncx)) {
@@ -14029,6 +14028,8 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
                                    param);
                }
                break;
+           case CXt_LOOP_PLAIN:
+               break;
            case CXt_FORMAT:
                ncx->blk_format.prevcomppad =
                         (PAD*)ptr_table_fetch(PL_ptr_table,