C<@a = @b = split(...)> optimization coredumps under ithreads
Gurusamy Sarathy [Mon, 11 Sep 2000 14:46:30 +0000 (14:46 +0000)]
(missed a spot when fixing up op_pmreplroot hack for ithreads)

p4raw-id: //depot/perl@7051

op.c
t/op/split.t

diff --git a/op.c b/op.c
index c31bf15..74d67e3 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3416,7 +3416,11 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
                    }
                    else if (curop->op_type == OP_PUSHRE) {
                        if (((PMOP*)curop)->op_pmreplroot) {
+#ifdef USE_ITHREADS
+                           GV *gv = (GV*)PL_curpad[(PADOFFSET)((PMOP*)curop)->op_pmreplroot];
+#else
                            GV *gv = (GV*)((PMOP*)curop)->op_pmreplroot;
+#endif
                            if (gv == PL_defgv || SvCUR(gv) == PL_generation)
                                break;
                            SvCUR(gv) = PL_generation;
index 78f51f5..45df76a 100755 (executable)
@@ -1,8 +1,6 @@
 #!./perl
 
-# $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $
-
-print "1..27\n";
+print "1..28\n";
 
 $FS = ':';
 
@@ -118,3 +116,9 @@ print "ok 26\n";
 $_ = join ':', split /^/, "ab\ncd\nef\n";
 print "not " if $_ ne "ab\n:cd\n:ef\n";
 print "ok 27\n";
+
+# see if @a = @b = split(...) optimization works
+@list1 = @list2 = split ('p',"a p b c p");
+print "not " if @list1 != @list2 or "@list1" ne "@list2"
+             or @list1 != 2 or "@list1" ne "a   b c ";
+print "ok 28\n";