fix optimizer bug in /^(?p{"a"})b/ (from Ilya Zakharevich)
Gurusamy Sarathy [Sat, 11 Mar 2000 10:08:47 +0000 (10:08 +0000)]
p4raw-id: //depot/perl@5644

regcomp.c
t/op/pat.t

index 9fbb3df..13fa36c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1222,7 +1222,7 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da
                if (data)
                    data->flags |= SF_HAS_EVAL;
        }
-       else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded */
+       else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded follows */
                if (flags & SCF_DO_SUBSTR) {
                    scan_commit(data);
                    data->longest = &(data->longest_float);
@@ -1230,6 +1230,7 @@ S_study_chunk(pTHX_ regnode **scanp, I32 *deltap, regnode *last, scan_data_t *da
                is_inf = is_inf_internal = 1;
                if (flags & SCF_DO_STCLASS_OR) /* Allow everything */
                    cl_anything(data->start_class);
+               flags &= ~SCF_DO_STCLASS;
        }
        /* Else: zero-length, ignore. */
        scan = regnext(scan);
index 103e613..7f20185 100755 (executable)
@@ -369,6 +369,10 @@ print "# ans='@ans'\n# expect='$expect'\nnot " if "@ans" ne $expect;
 print "ok $test\n";
 $test++;
 
+print "not " unless "abc" =~ /^(??{"a"})b/;
+print "ok $test\n";
+$test++;
+
 my $matched;
 $matched = qr/\((?:(?>[^()]+)|(??{$matched}))*\)/;