Commit | Line | Data |
---|---|---|
803e7e81 TC |
1 | #!perl |
2 | BEGIN { | |
a817e89d | 3 | chdir 't' if -d 't'; |
9224f6d1 | 4 | @INC = "../lib"; |
803e7e81 TC |
5 | } |
6 | ||
7 | use strict; | |
8 | require './test.pl'; | |
9 | use Config qw(%Config); | |
10 | ||
11 | $ENV{PERL_TEST_MEMORY} >= 1 | |
12 | or skip_all("Need ~1Gb for this test"); | |
13 | $Config{ptrsize} >= 8 | |
14 | or skip_all("Need 64-bit pointers for this test"); | |
15 | ||
16 | plan(7); | |
17 | ||
18 | # RT #111730: Negative offset to vec in lvalue context | |
803e7e81 TC |
19 | |
20 | my $v = ""; | |
21 | ok(scalar eval { vec($v, 0x80000000, 1) = 1 }, "set a bit at a large offset"); | |
22 | ok(vec($v, 0x80000000, 1), "check a bit at a large offset"); | |
fcb8da00 | 23 | |
803e7e81 TC |
24 | ok(scalar eval { vec($v, 0x100000000, 1) = 1 }, |
25 | "set a bit at a larger offset"); | |
26 | ok(vec($v, 0x100000000, 1), "check a bit at a larger offset"); | |
27 | ||
28 | # real out of range values | |
29 | ok(!eval { vec($v, -0x80000000, 1) = 1 }, | |
30 | "shouldn't be able to set at a large negative offset"); | |
803e7e81 TC |
31 | ok(!eval { vec($v, -0x100000000, 1) = 1 }, |
32 | "shouldn't be able to set at a larger negative offset"); | |
33 | ||
34 | ok(!vec($v, 0, 1), "make sure we didn't wrap"); |