In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/81731f9a265761ad276e361b6f96b29341821ef5?hp=7d2c6c240263992d62008c79c09438ef9f4a5e5e>

- Log -----------------------------------------------------------------
commit 81731f9a265761ad276e361b6f96b29341821ef5
Author: David Mitchell <da...@iabyn.com>
Date:   Mon Apr 16 11:47:00 2018 +0100

    Revert "S_regmatch: eliminate WHILEM_A_min paren saving"
    
    This reverts commit 77584140f7cbfe714083cacfa671085466e98a7b.
    
    This optimisation of mine from 5.25.9 is ill-conceived; under the right
    permutations of backtracking, it is possible for the current positions
    of one of more captures not to restored to their previous positions.
    
    This commit reverts the code change, but keeps the benchmark part of
    that commit, and adds a test

-----------------------------------------------------------------------

Summary of changes:
 regexec.c     | 7 +++++--
 t/re/re_tests | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/regexec.c b/regexec.c
index 142550811a..4b537f6872 100644
--- a/regexec.c
+++ b/regexec.c
@@ -7953,11 +7953,11 @@ NULL
            CACHEsayNO;
            NOT_REACHED; /* NOTREACHED */
 
+       case WHILEM_A_min_fail: /* just failed to match A in a minimal match */
+           /* FALLTHROUGH */
        case WHILEM_A_pre_fail: /* just failed to match even minimal A */
            REGCP_UNWIND(ST.lastcp);
             regcppop(rex, &maxopenparen);
-           /* FALLTHROUGH */
-       case WHILEM_A_min_fail: /* just failed to match A in a minimal match */
            cur_curlyx->u.curlyx.lastloc = ST.save_lastloc;
            cur_curlyx->u.curlyx.count--;
            CACHEsayNO;
@@ -8011,6 +8011,9 @@ NULL
            );
            /* Try grabbing another A and see if it helps. */
            cur_curlyx->u.curlyx.lastloc = locinput;
+            ST.cp = regcppush(rex, cur_curlyx->u.curlyx.parenfloor,
+                            maxopenparen);
+           REGCP_SET(ST.lastcp);
            PUSH_STATE_GOTO(WHILEM_A_min,
                /*A*/ NEXTOPER(ST.save_curlyx->u.curlyx.me) + EXTRA_STEP_2ARGS,
                 locinput);
diff --git a/t/re/re_tests b/t/re/re_tests
index f38743d0b0..54de12024c 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1990,6 +1990,7 @@ AB\s+\x{100}      AB \x{100}X     y       -       -
 [[:^ascii:]]+b \x80a\x81b      y       $&      \x81b
 [[:^ascii:]]+b \x80a\x81\x{100}b       y       $&      \x81\x{100}b
 /\A\x80+\z/    \x80\x80\x80\x80\x80\x80\x80\x80\x80    y       $&      
\x80\x80\x80\x80\x80\x80\x80\x80\x80            # [perl #132900]
+^(\d+)*?4X$    1234X   y       $1      123     # perl #131648
 
 # Keep these lines at the end of the file
 # vim: softtabstop=0 noexpandtab

-- 
Perl5 Master Repository

Reply via email to