Comparing an int to a U32 makes VC6 nervous.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index 1366976..a4b20e7 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3751,7 +3751,7 @@ Perl_newFOROP(pTHX_ I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *blo
                               append_elem(OP_LIST, expr, scalar(sv))));
     assert(!loop->op_next);
     /* for my  $x () sets OPpLVAL_INTRO;
-     * for our $x () sets OPpOUR_INTRO; both only used by Deparse.pm */
+     * for our $x () sets OPpOUR_INTRO */
     loop->op_private = (U8)iterpflags;
 #ifdef PL_OP_SLAB_ALLOC
     {
@@ -3796,6 +3796,8 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label)
     return o;
 }
 
+static void const_sv_xsub(pTHX_ CV* cv);
+
 /*
 =for apidoc cv_undef
 
@@ -3811,8 +3813,9 @@ void
 Perl_cv_undef(pTHX_ CV *cv)
 {
 #ifdef USE_ITHREADS
-    if (CvFILE(cv) && !CvXSUB(cv)) {
-       /* for XSUBs CvFILE point directly to static memory; __FILE__ */
+    if (CvFILE(cv) && (!CvXSUB(cv) || CvXSUB(cv) == const_sv_xsub)) {
+       /* for XSUBs CvFILE point directly to static memory; __FILE__ 
+        * except when XSUB was constructed via newCONSTSUB() */
        Safefree(CvFILE(cv));
     }
     CvFILE(cv) = 0;
@@ -3874,8 +3877,6 @@ Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p)
     }
 }
 
-static void const_sv_xsub(pTHX_ CV* cv);
-
 /*
 
 =head1 Optree Manipulation Functions
@@ -4359,6 +4360,9 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv)
     CvCONST_on(cv);
     sv_setpv((SV*)cv, "");  /* prototype is "" */
 
+    if (stash)
+       CopSTASH_free(PL_curcop);
+
     LEAVE;
 
     return cv;
@@ -4686,9 +4690,10 @@ Perl_ck_bitop(pTHX_ OP *o)
         (op) == OP_NE   || (op) == OP_I_NE || \
         (op) == OP_NCMP || (op) == OP_I_NCMP)
     o->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
-    if (o->op_type == OP_BIT_OR
-           || o->op_type == OP_BIT_AND
-           || o->op_type == OP_BIT_XOR)
+    if (!(o->op_flags & OPf_STACKED) /* Not an assignment */
+           && (o->op_type == OP_BIT_OR
+            || o->op_type == OP_BIT_AND
+            || o->op_type == OP_BIT_XOR))
     {
        OP * left = cBINOPo->op_first;
        OP * right = left->op_sibling;