[perl #56526] m/a{1,0}/ compiles but doesn't match a literal string
Michael Cartmell [Wed, 2 Jul 2008 05:17:58 +0000 (22:17 -0700)]
From: Michael Cartmell (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-27577-1215001078-1211.56526-75-0@perl.org>

p4raw-id: //depot/perl@34697

regcomp.c
t/op/re_tests

index 3934cec..7d1c474 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6452,7 +6452,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
                *flagp = WORST;
            if (max > 0)
                *flagp |= HASWIDTH;
-           if (max && max < min)
+           if (max < min)
                vFAIL("Can't do {n,m} with n > m");
            if (!SIZE_ONLY) {
                ARG1_SET(ret, (U16)min);
index 2b74175..0992b15 100644 (file)
@@ -618,6 +618,7 @@ $(?<=^(a))  a       y       $1      a
 ((?>[^()]+)|\([^()]*\))+       ((abc(ade)ufh()()x      y       $&      abc(ade)ufh()()x
 (?<=x+)y       -       c       -       Variable length lookbehind not implemented
 a{37,17}       -       c       -       Can't do {n,m} with n > m
+a{37,0}        -       c       -       Can't do {n,m} with n > m
 \Z     a\nb\n  y       $-[0]   3
 \z     a\nb\n  y       $-[0]   4
 $      a\nb\n  y       $-[0]   3