Commit 2f91a6be29 for perl
commit 2f91a6be29b95df5ad0f6b79eb4db6606d75f562
Author: David Mitchell <davem@iabyn.nospamdeletethisbit.com>
Date: Fri Sep 11 16:48:14 2026 +0100
regex: move SLC tests to pat.t
Move some tests for the super-linear cache from the generic
t/re/re_tests file into t/re/pat.t. This is in preparation for coming
modifications which can't be achieved within the standard re_tests
framework.
For now the actual tests are unchanged.
diff --git a/pod/perlreguts.pod b/pod/perlreguts.pod
index a11ac235fe..1f423a5bea 100644
--- a/pod/perlreguts.pod
+++ b/pod/perlreguts.pod
@@ -1303,7 +1303,7 @@ strong suspicion is that the outer must iterate at least twice (so is at
minimum C<{2,...}>) so that the first iteration can fail and mark the
cache, then the second incorrectly fail due to the cache.]
-There are some tests for nested quantifiers in F<t/re/re_tests> under the
+There are some tests for nested quantifiers in F<t/re/pat.t> under the
heading 'RT #79152'.
=item *
diff --git a/t/re/pat.t b/t/re/pat.t
index dcac176824..cf4320a5c5 100644
--- a/t/re/pat.t
+++ b/t/re/pat.t
@@ -28,7 +28,7 @@ skip_all_without_unicode_tables();
my $has_locales = locales_enabled('LC_CTYPE');
my $utf8_locale = find_utf8_ctype_locale();
-plan tests => 1302; # Update this when adding/deleting tests.
+plan tests => 1310; # Update this when adding/deleting tests.
run_tests() unless caller;
@@ -2664,6 +2664,34 @@ SKIP:
}
}
+
+ {
+ # Test the super-linear cache
+
+ # RT #79152
+ # Test the super-linear cache against nested quantifiers.
+ #
+ # Note that the first half of each of these patterns is there purely
+ # to soak up the initial cache countdown; the guts of the test is the
+ # second half.
+ ok("xayxay" =~ /(q1|.)*(q2|.)*(x(a|bc)*y){2,}/, 'SLC RT #79152 1');
+ is($&, "xayxay", 'SLC RT #79152 1 $&');
+
+ ok("xayxay" =~ /(q1|.)*(q2|.)*(x(a|bc)*y){2,3}/, 'SLC RT #79152 2');
+ is($&, "xayxay", 'SLC RT #79152 2 $&');
+
+ ok("zzzzzzzzzzzzzzzz-xayxayxayxayZ"
+ =~ /(q1|z)*(q2|z)*z{15}-.*?(x(a|bc)*y){2,3}Z/, 'SLC RT #79152 3');
+ is($&, "zzzzzzzzzzzzzzzz-xayxayxayxayZ", 'SLC RT #79152 3 $&');
+
+ # This tested a bug in the positive part of the SLC, which
+ # no longer exists; but might as well keep the test.
+ ok("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ =~ /^(a*?)(?!(a{6}|a{5})*$)/, 'SLC +ve');
+ is($+[1], "12", 'SLC +ve $+[1]');
+
+ }
+
{
# github #21661
fresh_perl_is(<<'PROG', <<'EXPECT', {}, "double-free on fatal warn with existing error");
diff --git a/t/re/re_tests b/t/re/re_tests
index ec972987ad..fbd1476724 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1070,7 +1070,6 @@ x(?# - c - Sequence (?#... not terminated
^(.)\s+.$(?(1)) A B y $1 A # [perl #37688]
(?:r?)*?r|(.{2,4}) abcde y $1 abcd
(?!)+?|(.{2,4}) abcde y $1 abcd
-^(a*?)(?!(a{6}|a{5})*$) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y $+[1] 12 # super-linear cache bug may return 18
^((?>(?:aa)?b)?) aab y $1 aab
^((?:aa)*)(?:X+((?:\d+|-)(?:X+(.+))?))?$ aaaaX5 y $1 aaaa
X(A|B||C|D)Y XXXYYY y $& XY # Trie w/ NOTHING
@@ -1635,15 +1634,6 @@ a(.)\4294967298 ab\o{42}94967298 ya $1 b \d not converted to native; \o{} is
[\0005] 5\000 y $& 5
[\_] _ y $& _
-# RT #79152
-# Test the super-linear cache against nested quantifiers.
-# Note that the first half of each of these patterns is there purely
-# to soak up the initial cache countdown; the guts of the test is the
-# second half.
-(q1|.)*(q2|.)*(x(a|bc)*y){2,} xayxay y $& xayxay
-(q1|.)*(q2|.)*(x(a|bc)*y){2,3} xayxay y $& xayxay
-(q1|z)*(q2|z)*z{15}-.*?(x(a|bc)*y){2,3}Z zzzzzzzzzzzzzzzz-xayxayxayxayZ y $& zzzzzzzzzzzzzzzz-xayxayxayxayZ
-
(?:(?:)foo|bar|zot|rt78356) foo y $& foo
/\xe0\pL/i \xc0a y $& \xc0a