This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
hv_func.h - fix seed initialization in sdbm and djb2 hashing algorithms.
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 8c332a9..5a7983f 100644 (file)
--- a/op.c
+++ b/op.c
@@ -109,6 +109,24 @@ recursive, but it's recursive on basic blocks, not on tree nodes.
 #define CALL_RPEEP(o) PL_rpeepp(aTHX_ o)
 #define CALL_OPFREEHOOK(o) if (PL_opfreehook) PL_opfreehook(aTHX_ o)
 
+/* remove any leading "empty" ops from the op_next chain whose first
+ * node's address is stored in op_p. Store the updated address of the
+ * first node in op_p.
+ */
+
+STATIC void
+S_prune_chain_head(pTHX_ OP** op_p)
+{
+    while (*op_p
+        && (   (*op_p)->op_type == OP_NULL
+            || (*op_p)->op_type == OP_SCOPE
+            || (*op_p)->op_type == OP_SCALAR
+            || (*op_p)->op_type == OP_LINESEQ)
+    )
+        *op_p = (*op_p)->op_next;
+}
+
+
 /* See the explanatory comments above struct opslab in op.h. */
 
 #ifdef PERL_DEBUG_READONLY_OPS
@@ -775,6 +793,7 @@ Perl_op_clear(pTHX_ OP *o)
            o->op_targ = 0;
            goto retry;
        }
+        /* FALLTHROUGH */
     case OP_ENTERTRY:
     case OP_ENTEREVAL: /* Was holding hints. */
        o->op_targ = 0;
@@ -783,7 +802,7 @@ Perl_op_clear(pTHX_ OP *o)
        if (!(o->op_flags & OPf_REF)
            || (PL_check[o->op_type] != Perl_ck_ftst))
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_GVSV:
     case OP_GV:
     case OP_AELEMFAST:
@@ -855,7 +874,7 @@ Perl_op_clear(pTHX_ OP *o)
     case OP_REDO:
        if (o->op_flags & (OPf_SPECIAL|OPf_STACKED|OPf_KIDS))
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_TRANS:
     case OP_TRANSR:
        if (o->op_private & (OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF)) {
@@ -888,7 +907,7 @@ Perl_op_clear(pTHX_ OP *o)
 #else
        SvREFCNT_dec(MUTABLE_SV(cPMOPo->op_pmreplrootu.op_pmtargetgv));
 #endif
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_MATCH:
     case OP_QR:
 clear_pmop:
@@ -1282,7 +1301,7 @@ Perl_scalar(pTHX_ OP *o)
        for (kid = cUNOPo->op_first->op_sibling; kid; kid = kid->op_sibling)
            scalar(kid);
        break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_SPLIT:
     case OP_MATCH:
     case OP_QR:
@@ -1416,7 +1435,7 @@ Perl_scalarvoid(pTHX_ OP *o)
     default:
        if (!(PL_opargs[o->op_type] & OA_FOLDCONST))
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_REPEAT:
        if (o->op_flags & OPf_STACKED)
            break;
@@ -1424,7 +1443,7 @@ Perl_scalarvoid(pTHX_ OP *o)
     case OP_SUBSTR:
        if (o->op_private == 4)
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_GVSV:
     case OP_WANTARRAY:
     case OP_GV:
@@ -1660,6 +1679,7 @@ Perl_scalarvoid(pTHX_ OP *o)
            }
            op_null(kid);
        }
+        /* FALLTHROUGH */
 
     case OP_DOR:
     case OP_COND_EXPR:
@@ -1672,14 +1692,14 @@ Perl_scalarvoid(pTHX_ OP *o)
     case OP_NULL:
        if (o->op_flags & OPf_STACKED)
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_NEXTSTATE:
     case OP_DBSTATE:
     case OP_ENTERTRY:
     case OP_ENTER:
        if (!(o->op_flags & OPf_KIDS))
            break;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_SCOPE:
     case OP_LEAVE:
     case OP_LEAVETRY:
@@ -1956,6 +1976,7 @@ S_finalize_op(pTHX_ OP* o)
 
     case OP_HSLICE:
        S_scalar_slice_warning(aTHX_ o);
+        /* FALLTHROUGH */
 
     case OP_KVHSLICE:
         kid = cLISTOPo->op_first->op_sibling;
@@ -2167,7 +2188,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
                    break;
            }
        }
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     default:
       nomod:
        if (flags & OP_LVALUE_NO_CROAK) return NULL;
@@ -2221,16 +2242,16 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
            PL_modcount = RETURN_UNLIMITED_NUMBER;
            return o;           /* Treat \(@foo) like ordinary list. */
        }
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_RV2GV:
        if (scalar_mod_type(o, type))
            goto nomod;
        ref(cUNOPo->op_first, o->op_type);
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_ASLICE:
     case OP_HSLICE:
        localize = 1;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_AASSIGN:
        /* Do not apply the lvsub flag for rv2[ah]v in scalar context.  */
        if (type == OP_LEAVESUBLV && (
@@ -2238,7 +2259,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
             || (o->op_flags & OPf_WANT) != OPf_WANT_SCALAR
           ))
            o->op_private |= OPpMAYBE_LVSUB;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_NEXTSTATE:
     case OP_DBSTATE:
        PL_modcount = RETURN_UNLIMITED_NUMBER;
@@ -2257,9 +2278,10 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
     case OP_RV2SV:
        ref(cUNOPo->op_first, o->op_type);
        localize = 1;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_GV:
        PL_hints |= HINT_BLOCK_SCOPE;
+        /* FALLTHROUGH */
     case OP_SASSIGN:
     case OP_ANDASSIGN:
     case OP_ORASSIGN:
@@ -2283,7 +2305,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
        if ((o->op_flags & OPf_WANT) != OPf_WANT_SCALAR
          && type == OP_LEAVESUBLV)
            o->op_private |= OPpMAYBE_LVSUB;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_PADSV:
        PL_modcount++;
        if (!type) /* local() */
@@ -2303,7 +2325,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
     case OP_SUBSTR:
        if (o->op_private == 4) /* don't allow 4 arg substr as lvalue */
            goto nomod;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_POS:
     case OP_VEC:
       lvalue_func:
@@ -2328,6 +2350,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
     case OP_LEAVE:
     case OP_LEAVELOOP:
        o->op_private |= OPpLVALUE;
+        /* FALLTHROUGH */
     case OP_SCOPE:
     case OP_ENTER:
     case OP_LINESEQ:
@@ -2346,7 +2369,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
            op_lvalue(cBINOPo->op_first, type);
            break;
        }
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_LIST:
        localize = 0;
        for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
@@ -2415,7 +2438,7 @@ S_scalar_mod_type(const OP *o, I32 type)
     case OP_SASSIGN:
        if (o && o->op_type == OP_RV2GV)
            return FALSE;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_PREINC:
     case OP_PREDEC:
     case OP_POSTINC:
@@ -2467,7 +2490,7 @@ S_is_handle_constructor(const OP *o, I32 numargs)
     case OP_SOCKPAIR:
        if (numargs == 2)
            return TRUE;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_SYSOPEN:
     case OP_OPEN:
     case OP_SELECT:            /* XXX c.f. SelectSaver.pm */
@@ -2532,7 +2555,7 @@ Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref)
        if (type == OP_DEFINED)
            o->op_flags |= OPf_SPECIAL;         /* don't create GV */
        doref(cUNOPo->op_first, o->op_type, set_op_ref);
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_PADSV:
        if (type == OP_RV2SV || type == OP_RV2AV || type == OP_RV2HV) {
            o->op_private |= (type == OP_RV2AV ? OPpDEREF_AV
@@ -2546,7 +2569,7 @@ Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref)
     case OP_RV2HV:
        if (set_op_ref)
            o->op_flags |= OPf_REF;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_RV2GV:
        if (type == OP_DEFINED)
            o->op_flags |= OPf_SPECIAL;         /* don't create GV */
@@ -2579,7 +2602,7 @@ Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref)
     case OP_SCOPE:
     case OP_LEAVE:
        set_op_ref = FALSE;
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     case OP_ENTER:
     case OP_LIST:
        if (!(o->op_flags & OPf_KIDS))
@@ -2889,6 +2912,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
            S_cant_declare(aTHX_ o);
        } else if (attrs) {
            GV * const gv = cGVOPx_gv(cUNOPo->op_first);
+           assert(PL_parser);
            PL_parser->in_my = FALSE;
            PL_parser->in_my_stash = NULL;
            apply_attrs(GvSTASH(gv),
@@ -2911,6 +2935,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
     else if (attrs && type != OP_PUSHMARK) {
        HV *stash;
 
+        assert(PL_parser);
        PL_parser->in_my = FALSE;
        PL_parser->in_my_stash = NULL;
 
@@ -3297,6 +3322,7 @@ Perl_newPROG(pTHX_ OP *o)
        ENTER;
        CALL_PEEP(PL_eval_start);
        finalize_optree(PL_eval_root);
+        S_prune_chain_head(aTHX_ &PL_eval_start);
        LEAVE;
        PL_savestack_ix = i;
     }
@@ -3341,6 +3367,7 @@ Perl_newPROG(pTHX_ OP *o)
        PL_main_root->op_next = 0;
        CALL_PEEP(PL_main_start);
        finalize_optree(PL_main_root);
+        S_prune_chain_head(aTHX_ &PL_main_start);
        cv_forget_slab(PL_compcv);
        PL_compcv = 0;
 
@@ -3647,9 +3674,11 @@ S_gen_constant_list(pTHX_ OP *o)
     if (PL_parser && PL_parser->error_count)
        return o;               /* Don't attempt to run with errors */
 
-    PL_op = curop = LINKLIST(o);
+    curop = LINKLIST(o);
     o->op_next = 0;
     CALL_PEEP(curop);
+    S_prune_chain_head(aTHX_ &curop);
+    PL_op = curop;
     Perl_pp_pushmark(aTHX);
     CALLRUNOPS(aTHX);
     PL_op = curop;
@@ -4876,6 +4905,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg, I32 floor)
            /* have to peep the DOs individually as we've removed it from
             * the op_next chain */
            CALL_PEEP(o);
+            S_prune_chain_head(aTHX_ &(o->op_next));
            if (is_compiletime)
                /* runtime finalizes as part of finalizing whole tree */
                finalize_optree(o);
@@ -7059,7 +7089,7 @@ S_looks_like_bool(pTHX_ const OP *o)
            else
                return FALSE;
 
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
        default:
            return FALSE;
     }
@@ -7225,10 +7255,28 @@ Perl_cv_const_sv_or_av(pTHX_ const CV * const cv)
 }
 
 /* op_const_sv:  examine an optree to determine whether it's in-lineable.
+ * Can be called in 3 ways:
+ *
+ * !cv
+ *     look for a single OP_CONST with attached value: return the value
+ *
+ * cv && CvCLONE(cv) && !CvCONST(cv)
+ *
+ *     examine the clone prototype, and if contains only a single
+ *     OP_CONST referencing a pad const, or a single PADSV referencing
+ *     an outer lexical, return a non-zero value to indicate the CV is
+ *     a candidate for "constizing" at clone time
+ *
+ * cv && CvCONST(cv)
+ *
+ *     We have just cloned an anon prototype that was marked as a const
+ *     candidate. Try to grab the current value, and in the case of
+ *     PADSV, ignore it if it has multiple references. In this case we
+ *     return a newly created *copy* of the value.
  */
 
 SV *
-Perl_op_const_sv(pTHX_ const OP *o)
+Perl_op_const_sv(pTHX_ const OP *o, CV *cv)
 {
     dVAR;
     SV *sv = NULL;
@@ -7261,6 +7309,27 @@ Perl_op_const_sv(pTHX_ const OP *o)
            return NULL;
        if (type == OP_CONST && cSVOPo->op_sv)
            sv = cSVOPo->op_sv;
+       else if (cv && type == OP_CONST) {
+           sv = PAD_BASE_SV(CvPADLIST(cv), o->op_targ);
+           if (!sv)
+               return NULL;
+       }
+       else if (cv && type == OP_PADSV) {
+           if (CvCONST(cv)) { /* newly cloned anon */
+               sv = PAD_BASE_SV(CvPADLIST(cv), o->op_targ);
+               /* the candidate should have 1 ref from this pad and 1 ref
+                * from the parent */
+               if (!sv || SvREFCNT(sv) != 2)
+                   return NULL;
+               sv = newSVsv(sv);
+               SvREADONLY_on(sv);
+               return sv;
+           }
+           else {
+               if (PAD_COMPNAME_FLAGS(o->op_targ) & SVf_FAKE)
+                   sv = &PL_sv_undef; /* an arbitrary non-null value */
+           }
+       }
        else {
            return NULL;
        }
@@ -7432,7 +7501,7 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
        )
        const_sv = NULL;
     else
-       const_sv = op_const_sv(block);
+       const_sv = op_const_sv(block, NULL);
 
     if (cv) {
         const bool exists = CvROOT(cv) || CvXSUB(cv);
@@ -7599,11 +7668,18 @@ Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     CvROOT(cv)->op_next = 0;
     CALL_PEEP(CvSTART(cv));
     finalize_optree(CvROOT(cv));
+    S_prune_chain_head(aTHX_ &CvSTART(cv));
 
     /* now that optimizer has done its work, adjust pad values */
 
     pad_tidy(CvCLONE(cv) ? padtidy_SUBCLONE : padtidy_SUB);
 
+    if (CvCLONE(cv)) {
+       assert(!CvCONST(cv));
+       if (ps && !*ps && op_const_sv(block, cv))
+           CvCONST_on(cv);
+    }
+
   attrs:
     if (attrs) {
        /* Need to do a C<use attributes $stash_of_cv,\&cv,@attrs>. */
@@ -7798,7 +7874,7 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
        )
        const_sv = NULL;
     else
-       const_sv = op_const_sv(block);
+       const_sv = op_const_sv(block, NULL);
 
     if (cv) {
         const bool exists = CvROOT(cv) || CvXSUB(cv);
@@ -7954,11 +8030,18 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
     CvROOT(cv)->op_next = 0;
     CALL_PEEP(CvSTART(cv));
     finalize_optree(CvROOT(cv));
+    S_prune_chain_head(aTHX_ &CvSTART(cv));
 
     /* now that optimizer has done its work, adjust pad values */
 
     pad_tidy(CvCLONE(cv) ? padtidy_SUBCLONE : padtidy_SUB);
 
+    if (CvCLONE(cv)) {
+       assert(!CvCONST(cv));
+       if (ps && !*ps && op_const_sv(block, cv))
+           CvCONST_on(cv);
+    }
+
   attrs:
     if (attrs) {
        /* Need to do a C<use attributes $stash_of_cv,\&cv,@attrs>. */
@@ -8351,6 +8434,7 @@ Perl_newFORM(pTHX_ I32 floor, OP *o, OP *block)
     CvROOT(cv)->op_next = 0;
     CALL_PEEP(CvSTART(cv));
     finalize_optree(CvROOT(cv));
+    S_prune_chain_head(aTHX_ &CvSTART(cv));
     cv_forget_slab(cv);
 
   finish:
@@ -8539,6 +8623,7 @@ Perl_ck_anoncode(pTHX_ OP *o)
 static void
 S_io_hints(pTHX_ OP *o)
 {
+#ifdef PERLIO_BINARY_AND_TEXT_DIFFERENT_AND_EFFECTIVE
     HV * const table =
        PL_hints & HINT_LOCALIZE_HH ? GvHV(PL_hintgv) : NULL;;
     if (table) {
@@ -8564,6 +8649,9 @@ S_io_hints(pTHX_ OP *o)
                o->op_private |= OPpOPEN_OUT_CRLF;
        }
     }
+#else
+    PERL_UNUSED_ARG(o);
+#endif
 }
 
 OP *
@@ -8710,13 +8798,13 @@ Perl_ck_delete(pTHX_ OP *o)
        switch (kid->op_type) {
        case OP_ASLICE:
            o->op_flags |= OPf_SPECIAL;
-           /* FALL THROUGH */
+           /* FALLTHROUGH */
        case OP_HSLICE:
            o->op_private |= OPpSLICE;
            break;
        case OP_AELEM:
            o->op_flags |= OPf_SPECIAL;
-           /* FALL THROUGH */
+           /* FALLTHROUGH */
        case OP_HELEM:
            break;
        case OP_KVASLICE:
@@ -10152,6 +10240,7 @@ Perl_ck_split(pTHX_ OP *o)
        op_append_elem(OP_SPLIT, o, newDEFSVOP());
 
     kid = kid->op_sibling;
+    assert(kid);
     scalar(kid);
 
     if (!kid->op_sibling)
@@ -10411,6 +10500,7 @@ Perl_ck_entersub_args_proto(pTHX_ OP *entersubop, GV *namegv, SV *protosv)
                /* _ must be at the end */
                if (proto[1] && !strchr(";@%", proto[1]))
                    goto oops;
+                /* FALLTHROUGH */
            case '$':
                proto++;
                arg++;
@@ -10825,6 +10915,7 @@ Perl_cv_set_call_checker(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj)
        MAGIC *callmg;
        sv_magic((SV*)cv, &PL_sv_undef, PERL_MAGIC_checkcall, NULL, 0);
        callmg = mg_find((SV*)cv, PERL_MAGIC_checkcall);
+       assert(callmg);
        if (callmg->mg_flags & MGf_REFCOUNTED) {
            SvREFCNT_dec(callmg->mg_obj);
            callmg->mg_flags &= ~MGf_REFCOUNTED;
@@ -11149,21 +11240,28 @@ S_inplace_aassign(pTHX_ OP *o) {
     op_null(oleft);
 }
 
+
+
+/* mechanism for deferring recursion in rpeep() */
+
 #define MAX_DEFERRED 4
 
 #define DEFER(o) \
   STMT_START { \
     if (defer_ix == (MAX_DEFERRED-1)) { \
-       CALL_RPEEP(defer_queue[defer_base]); \
+        OP **defer = defer_queue[defer_base]; \
+        CALL_RPEEP(*defer); \
+        S_prune_chain_head(aTHX_ defer); \
        defer_base = (defer_base + 1) % MAX_DEFERRED; \
        defer_ix--; \
     } \
-    defer_queue[(defer_base + ++defer_ix) % MAX_DEFERRED] = o; \
+    defer_queue[(defer_base + ++defer_ix) % MAX_DEFERRED] = &(o); \
   } STMT_END
 
 #define IS_AND_OP(o)   (o->op_type == OP_AND)
 #define IS_OR_OP(o)    (o->op_type == OP_OR)
 
+
 STATIC void
 S_null_listop_in_list_context(pTHX_ OP *o)
 {
@@ -11194,7 +11292,7 @@ Perl_rpeep(pTHX_ OP *o)
     dVAR;
     OP* oldop = NULL;
     OP* oldoldop = NULL;
-    OP* defer_queue[MAX_DEFERRED]; /* small queue of deferred branches */
+    OP** defer_queue[MAX_DEFERRED]; /* small queue of deferred branches */
     int defer_base = 0;
     int defer_ix = -1;
 
@@ -11207,8 +11305,12 @@ Perl_rpeep(pTHX_ OP *o)
        if (o && o->op_opt)
            o = NULL;
        if (!o) {
-           while (defer_ix >= 0)
-               CALL_RPEEP(defer_queue[(defer_base + defer_ix--) % MAX_DEFERRED]);
+           while (defer_ix >= 0) {
+                OP **defer =
+                        defer_queue[(defer_base + defer_ix--) % MAX_DEFERRED];
+                CALL_RPEEP(*defer);
+                S_prune_chain_head(aTHX_ defer);
+            }
            break;
        }
 
@@ -11448,12 +11550,12 @@ Perl_rpeep(pTHX_ OP *o)
               though (See 20010220.007). AMS 20010719 */
            /* op_seq functionality is now replaced by op_opt */
            o->op_opt = 0;
-           /* FALL THROUGH */
+           /* FALLTHROUGH */
        case OP_SCALAR:
        case OP_LINESEQ:
        case OP_SCOPE:
        nothin:
-           if (oldop && o->op_next) {
+           if (oldop) {
                oldop->op_next = o->op_next;
                o->op_opt = 0;
                continue;
@@ -12074,6 +12176,23 @@ Perl_rpeep(pTHX_ OP *o)
            if (OP_GIMME(o,0) == G_VOID) {
                OP *right = cBINOP->op_first;
                if (right) {
+                    /*   sassign
+                    *      RIGHT
+                    *      substr
+                    *         pushmark
+                    *         arg1
+                    *         arg2
+                    *         ...
+                    * becomes
+                    *
+                    *  ex-sassign
+                    *     substr
+                    *        pushmark
+                    *        RIGHT
+                    *        arg1
+                    *        arg2
+                    *        ...
+                    */
                    OP *left = right->op_sibling;
                    if (left->op_type == OP_SUBSTR
                         && (left->op_private & 7) < 4) {
@@ -12099,8 +12218,16 @@ Perl_rpeep(pTHX_ OP *o)
        }
            
        }
-       oldoldop = oldop;
-       oldop = o;
+        /* did we just null the current op? If so, re-process it to handle
+         * eliding "empty" ops from the chain */
+        if (o->op_type == OP_NULL && oldop && oldop->op_next == o) {
+            o->op_opt = 0;
+            o = oldop;
+        }
+        else {
+            oldoldop = oldop;
+            oldop = o;
+        }
     }
     LEAVE;
 }
@@ -12387,7 +12514,7 @@ Perl_coresub_op(pTHX_ SV * const coreargssv, const int code,
                                    OP_SSELECT),
                         coresub_op(coreargssv, 0, OP_SELECT)
                   );
-       /* FALL THROUGH */
+       /* FALLTHROUGH */
     default:
        switch (PL_opargs[opnum] & OA_CLASS_MASK) {
        case OA_BASEOP: