Skip to content

Commit

Permalink
[perl #43425] local $[: fix scoping during parser error handling.
Browse files Browse the repository at this point in the history
 Change 22306# inadvertently made 'local $[' statement-scoped
 rather than block-scoped; so revert that change and add a
 different fix. The problem was to ensure that the savestack got
 popped correctly while popping errored tokens. We how record the
 current value of PL_savestack_ix with each pushed parser state.

p4raw-id: //depot/perl@31615
  • Loading branch information
Dave Mitchell committed Jul 16, 2007
1 parent 4629c4f commit 503de47
Show file tree
Hide file tree
Showing 8 changed files with 1,094 additions and 1,098 deletions.
6 changes: 6 additions & 0 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -4969,6 +4969,12 @@ void
Perl_cv_undef(pTHX_ CV *cv)
{
dVAR;

DEBUG_X(PerlIO_printf(Perl_debug_log,
"CV undef: cv=0x%"UVxf" comppad=0x%"UVxf"\n",
PTR2UV(cv), PTR2UV(PL_comppad))
);

#ifdef USE_ITHREADS
if (CvFILE(cv) && !CvISXSUB(cv)) {
/* for XSUBs CvFILE point directly to static memory; __FILE__ */
Expand Down
4 changes: 2 additions & 2 deletions pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ Perl_pad_undef(pTHX_ CV* cv)
return;

DEBUG_X(PerlIO_printf(Perl_debug_log,
"Pad undef: cv=0x%"UVxf" padlist=0x%"UVxf"\n",
PTR2UV(cv), PTR2UV(padlist))
"Pad undef: cv=0x%"UVxf" padlist=0x%"UVxf" comppad=0x%"UVxf"\n",
PTR2UV(cv), PTR2UV(padlist), PTR2UV(PL_comppad))
);

/* detach any '&' anon children in the pad; if afterwards they
Expand Down
1 change: 1 addition & 0 deletions parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef struct {
AV *comppad; /* value of PL_comppad when this value was created */
#ifdef DEBUGGING
const char *name; /* token/rule name for -Dpv */
I32 savestack_ix; /* size of savestack at this state */
#endif
} yy_stack_frame;

Expand Down
Loading

0 comments on commit 503de47

Please sign in to comment.