This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
allow wrap-around of PL_cop_seqmax
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 371c1e6..2e15a8d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3778,10 +3778,10 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
     if (PL_hints & HINT_RE_TAINT)
        pmop->op_pmflags |= PMf_RETAINT;
     if (PL_hints & HINT_LOCALE) {
-       pmop->op_pmflags |= PMf_LOCALE;
+       set_regex_charset(&(pmop->op_pmflags), REGEX_LOCALE_CHARSET);
     }
     else if ((! (PL_hints & HINT_BYTES)) && (PL_hints & HINT_UNI_8_BIT)) {
-        pmop->op_pmflags |= RXf_PMf_UNICODE;
+       set_regex_charset(&(pmop->op_pmflags), REGEX_UNICODE_CHARSET);
     }
     if (PL_hints & HINT_RE_FLAGS) {
         SV *reflags = Perl_refcounted_he_fetch_pvn(aTHX_
@@ -3792,8 +3792,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
          PL_compiling.cop_hints_hash, STR_WITH_LEN("reflags_charset"), 0, 0
         );
         if (reflags && SvOK(reflags)) {
-            pmop->op_pmflags &= ~(RXf_PMf_LOCALE|RXf_PMf_UNICODE);
-            pmop->op_pmflags |= SvIV(reflags);
+            set_regex_charset(&(pmop->op_pmflags), (regex_charset)SvIV(reflags));
         }
     }
 
@@ -3886,7 +3885,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg)
 
     if (expr->op_type == OP_CONST) {
        SV *pat = ((SVOP*)expr)->op_sv;
-       U32 pm_flags = pm->op_pmflags & PMf_COMPILETIME;
+       U32 pm_flags = pm->op_pmflags & RXf_PMf_COMPILETIME;
 
        if (o->op_flags & OPf_SPECIAL)
            pm_flags |= RXf_SPLIT;
@@ -4357,6 +4356,8 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
     PL_parser->copline = NOLINE;
     PL_parser->expect = XSTATE;
     PL_cop_seqmax++; /* Purely for B::*'s benefit */
+    if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */
+       PL_cop_seqmax++;
 
 #ifdef PERL_MAD
     if (!PL_madskills) {
@@ -6245,7 +6246,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
            CvISXSUB_on(cv);
        }
        else {
-           GvCV(gv) = NULL;
+           GvCV_set(gv, NULL);
            cv = newCONSTSUB(NULL, name, const_sv);
        }
         mro_method_changed_in( /* sub Foo::Bar () { 123 } */
@@ -6310,7 +6311,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
     else {
        cv = PL_compcv;
        if (name) {
-           GvCV(gv) = cv;
+           GvCV_set(gv, cv);
            if (PL_madskills) {
                if (strEQ(name, "import")) {
                    PL_formfeed = MUTABLE_SV(cv);
@@ -6456,7 +6457,7 @@ S_process_special_blocks(pTHX_ const char *const fullname, GV *const gv,
 
            DEBUG_x( dump_sub(gv) );
            Perl_av_create_and_push(aTHX_ &PL_beginav, MUTABLE_SV(cv));
-           GvCV(gv) = 0;               /* cv has been hijacked */
+           GvCV_set(gv,0);             /* cv has been hijacked */
            call_list(oldscope, PL_beginav);
 
            PL_curcop = &PL_compiling;
@@ -6500,7 +6501,7 @@ S_process_special_blocks(pTHX_ const char *const fullname, GV *const gv,
        } else
            return;
        DEBUG_x( dump_sub(gv) );
-       GvCV(gv) = 0;           /* cv has been hijacked */
+       GvCV_set(gv,0);         /* cv has been hijacked */
     }
 }
 
@@ -6678,7 +6679,7 @@ Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename)
     else {
        cv = MUTABLE_CV(newSV_type(SVt_PVCV));
        if (name) {
-           GvCV(gv) = cv;
+           GvCV_set(gv,cv);
            GvCVGEN(gv) = 0;
             mro_method_changed_in(GvSTASH(gv)); /* newXS */
        }
@@ -7654,7 +7655,7 @@ Perl_ck_glob(pTHX_ OP *o)
                newSVpvs("File::Glob"), NULL, NULL, NULL);
        if((glob_gv = gv_fetchpvs("File::Glob::csh_glob", 0, SVt_PVCV))) {
            gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV);
-           GvCV(gv) = GvCV(glob_gv);
+           GvCV_set(gv, GvCV(glob_gv));
            SvREFCNT_inc_void(MUTABLE_SV(GvCV(gv)));
            GvIMPORTED_CV_on(gv);
        }