Skip to content

Commit

Permalink
many string evals cause eventual scope issues
Browse files Browse the repository at this point in the history
[perl #83364]. PL_cop_seqmax is U32 but PAD_MAX was defined as
I32_MAX. Once PL_cop_seqmax got above 2 billion it would start to appear
spuriosuly as if  PL_cop_seqmax > PAD_MAX, so the scope of lexical vars in
evals etc went awry.

Also replaces a use of ~0 with PAD_MAX, which shouldn't change anything,
but is just tidier.
  • Loading branch information
iabyn committed Feb 6, 2011
1 parent 5bcf08c commit d1bfb64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pad.c
Expand Up @@ -128,7 +128,7 @@ For state vars, SVs_PADSTALE is overloaded to mean 'not yet initialised'
#define PARENT_FAKELEX_FLAGS_set(sv,val) \
STMT_START { ((XPVNV*)SvANY(sv))->xnv_u.xpad_cop_seq.xhigh = (val); } STMT_END

#define PAD_MAX I32_MAX
#define PAD_MAX U32_MAX

#ifdef PERL_MAD
void pad_peg(const char* s) {
Expand Down Expand Up @@ -591,7 +591,7 @@ Perl_pad_add_anon(pTHX_ SV* sv, OPCODE op_type)
pad_peg("add_anon");
sv_setpvs(name, "&");
/* Are these two actually ever read? */
COP_SEQ_RANGE_HIGH_set(name, ~0);
COP_SEQ_RANGE_HIGH_set(name, PAD_MAX);
COP_SEQ_RANGE_LOW_set(name, 1);
ix = pad_alloc(op_type, SVs_PADMY);
av_store(PL_comppad_name, ix, name);
Expand Down

0 comments on commit d1bfb64

Please sign in to comment.