16fb12b70Safresh1#!perl 26fb12b70Safresh1BEGIN { 3*b8851fccSafresh1 chdir 't' if -d 't'; 4*b8851fccSafresh1 @INC = "../lib"; 56fb12b70Safresh1 require './test.pl'; 66fb12b70Safresh1} 76fb12b70Safresh1 86fb12b70Safresh1use Config qw(%Config); 96fb12b70Safresh1 106fb12b70Safresh1$ENV{PERL_TEST_MEMORY} >= 2 116fb12b70Safresh1 or skip_all("Need ~2Gb for this test"); 126fb12b70Safresh1$Config{ptrsize} >= 8 136fb12b70Safresh1 or skip_all("Need 64-bit pointers for this test"); 146fb12b70Safresh1 156fb12b70Safresh1plan(6); 166fb12b70Safresh1 176fb12b70Safresh1# [perl #116907] 186fb12b70Safresh1# ${\2} to defeat constant folding, which in this case actually slows 196fb12b70Safresh1# things down 206fb12b70Safresh1my $x=" "x(${\2}**31) . "abcdefg"; 216fb12b70Safresh1ok $x =~ /./, 'match against long string succeeded'; 226fb12b70Safresh1is "$-[0]-$+[0]", '0-1', '@-/@+ after match against long string'; 236fb12b70Safresh1 246fb12b70Safresh1pos $x = 2**31-1; 256fb12b70Safresh1my $result; 266fb12b70Safresh1for(1..5) { 276fb12b70Safresh1 $x =~ /./g; 286fb12b70Safresh1 $result .= "$&-"; 296fb12b70Safresh1} 306fb12b70Safresh1is $result," -a-b-c-d-", 'scalar //g hopping past the 2**31 threshold'; 316fb12b70Safresh1pos $x = 2**31+3; 326fb12b70Safresh1$x =~ /./g; 336fb12b70Safresh1is "$'", 'efg', q "$' after match against long string"; 346fb12b70Safresh1is "$-[0],$+[0]", '2147483651,2147483652', 356fb12b70Safresh1 '@- and @+ after matches past 2**31'; 366fb12b70Safresh1 376fb12b70Safresh1# Substring optimisations 386fb12b70Safresh1is $x =~ /(?:(?:.{32766}){32766}){2}(?:.{32766}){8}.{8}ef/, 1, 396fb12b70Safresh1 'anchored substr past 2**31'; 40