summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-24 14:23:54 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-25 12:23:59 -0700
commit389ecb564541f5a336b531db204970925ed27790 (patch)
tree48dd3aa4343e7c093fa79c7945725cba5ac24aa6 /t
parentbf05793b4d0b88b38e2379fc326d791af6c2cab0 (diff)
downloadperl-389ecb564541f5a336b531db204970925ed27790.tar.gz
Stop minlen regexp optimisation from rejecting long strings
This fixes #112790 and part of #116907. The length of the string is cast to I32, so it wraps and end up less than the minimum length. For now, simply skip this optimisation if minlen itself wraps and becomes negative.
Diffstat (limited to 't')
-rw-r--r--t/bigmem/regexp.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/bigmem/regexp.t b/t/bigmem/regexp.t
new file mode 100644
index 0000000000..ef029fbd9b
--- /dev/null
+++ b/t/bigmem/regexp.t
@@ -0,0 +1,22 @@
+#!perl
+BEGIN {
+ chdir 't';
+ unshift @INC, "../lib";
+ require './test.pl';
+}
+
+use Config qw(%Config);
+
+$ENV{PERL_TEST_MEMORY} >= 2
+ or skip_all("Need ~2Gb for this test");
+$Config{ptrsize} >= 8
+ or skip_all("Need 64-bit pointers for this test");
+
+plan(2);
+
+# [perl #116907]
+# ${\2} to defeat constant folding, which in this case actually slows
+# things down
+my $x=" "x(${\2}**31);
+ok $x =~ /./, 'match against long string succeeded';
+is "$-[0]-$+[0]", '0-1', '@-/@+ after match against long string';