t/base/term.t See if various terms work
t/base/while.t See if while work
t/benchmark/rt26188-speed-up-keys-on-empty-hash.t Benchmark if keys on empty hashes is fast enough
+t/bigmem/pos.t Check that pos() handles large offsets
t/bigmem/read.t Check read() handles large offsets
t/bigmem/vec.t Check vec() handles large offsets
t/cmd/elsif.t See if else-if works
poM |void |hv_kill_backrefs |NN HV *hv
#endif
Apd |void |hv_clear_placeholders |NN HV *hv
-ApoR |I32* |hv_placeholders_p |NN HV *hv
+XpoR |SSize_t*|hv_placeholders_p |NN HV *hv
ApoR |I32 |hv_placeholders_get |NN const HV *hv
Apo |void |hv_placeholders_set |NN HV *hv|I32 ph
return HeKEY_hek(entry);
}
-I32 *
+SSize_t *
Perl_hv_placeholders_p(pTHX_ HV *hv)
{
dVAR;
PERL_ARGS_ASSERT_MAGIC_GETPOS;
PERL_UNUSED_ARG(mg);
- if (found && found->mg_len >= 0) {
- I32 i = found->mg_len;
+ if (found && found->mg_len != -1) {
+ STRLEN i = found->mg_len;
if (DO_UTF8(lsv))
- sv_pos_b2u(lsv, &i);
- sv_setiv(sv, i);
+ i = sv_pos_b2u_flags(lsv, i, SV_GMAGIC|SV_CONST_RETURN);
+ sv_setuv(sv, i);
return 0;
}
SvOK_off(sv);
U16 mg_private;
char mg_type;
U8 mg_flags;
- I32 mg_len;
+ SSize_t mg_len;
SV* mg_obj;
char* mg_ptr;
};
}
else {
const MAGIC * const mg = mg_find_mglob(sv);
- if (mg && mg->mg_len >= 0) {
+ if (mg && mg->mg_len != -1) {
dTARGET;
- I32 i = mg->mg_len;
+ STRLEN i = mg->mg_len;
if (DO_UTF8(sv))
- sv_pos_b2u(sv, &i);
- PUSHi(i);
+ i = sv_pos_b2u_flags(sv, i, SV_GMAGIC|SV_CONST_RETURN);
+ PUSHu(i);
RETURN;
}
RETPUSHUNDEF;
#define PERL_ARGS_ASSERT_HV_PLACEHOLDERS_GET \
assert(hv)
-PERL_CALLCONV I32* Perl_hv_placeholders_p(pTHX_ HV *hv)
+PERL_CALLCONV SSize_t* Perl_hv_placeholders_p(pTHX_ HV *hv)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_HV_PLACEHOLDERS_P \
--- /dev/null
+#!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(3);
+
+# [perl #116907]
+# ${\2} to defeat constant folding, which in this case actually slows
+# things down
+my $x=" "x(${\2}**31+20);
+pos $x = 2**31-5;
+is pos $x, 2147483643, 'setting pos on large string';
+pos $x += 10;
+is pos $x, 2147483653, 'reading lvalue pos after setting it > 2**31';
+is scalar(pos $x), 2147483653, 'reading it with pos() in rvalue context';