| 1 | #!perl |
| 2 | BEGIN { |
| 3 | chdir 't' if -d 't'; |
| 4 | @INC = "../lib"; |
| 5 | require './test.pl'; |
| 6 | } |
| 7 | |
| 8 | use Config qw(%Config); |
| 9 | |
| 10 | $ENV{PERL_TEST_MEMORY} >= 2 |
| 11 | or skip_all("Need ~2Gb for this test"); |
| 12 | $Config{ptrsize} >= 8 |
| 13 | or skip_all("Need 64-bit pointers for this test"); |
| 14 | |
| 15 | plan(3); |
| 16 | |
| 17 | # [perl #116907] |
| 18 | # ${\2} to defeat constant folding, which in this case actually slows |
| 19 | # things down |
| 20 | my $x=" "x(${\2}**31+20); |
| 21 | pos $x = 2**31-5; |
| 22 | is pos $x, 2147483643, 'setting pos on large string'; |
| 23 | pos $x += 10; |
| 24 | is pos $x, 2147483653, 'reading lvalue pos after setting it > 2**31'; |
| 25 | is scalar(pos $x), 2147483653, 'reading it with pos() in rvalue context'; |