summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-02-15 00:24:26 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-02-15 00:24:26 +0000
commit500bedb6c28d0918a4bd28632e742d0905ce8519 (patch)
tree3bbed23b46dd15027bd2173c4d593faea7275821 /perly.y
parent9388183fea7d692a0a6ded83ccc01767a8af49cf (diff)
downloadperl-500bedb6c28d0918a4bd28632e742d0905ce8519.tar.gz
[perl #25824] Segmentation fault with
sub x { shift; @a = @b; eval +{ use } } p4raw-id: //depot/perl@22306
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y14
1 files changed, 9 insertions, 5 deletions
diff --git a/perly.y b/perly.y
index d87c873363..f4a83442ef 100644
--- a/perly.y
+++ b/perly.y
@@ -40,7 +40,7 @@
%token COLONATTR
%type <ival> prog decl format startsub startanonsub startformsub
-%type <ival> progstart remember mremember '&'
+%type <ival> progstart remember mremember '&' savescope
%type <opval> block mblock lineseq line loop cond else
%type <opval> expr term subscripted scalar ary hsh arylen star amper sideff
%type <opval> argexpr nexpr texpr iexpr mexpr mnexpr mtexpr miexpr
@@ -116,16 +116,20 @@ mremember: /* NULL */ /* start a partial lexical scope */
{ $$ = block_start(FALSE); }
;
+savescope: /* NULL */ /* remember stack pos in case of error */
+ { $$ = PL_savestack_ix; }
+
/* A collection of "lines" in the program */
lineseq : /* NULL */
{ $$ = Nullop; }
| lineseq decl
{ $$ = $1; }
- | lineseq line
- { $$ = append_list(OP_LINESEQ,
- (LISTOP*)$1, (LISTOP*)$2);
+ | lineseq savescope line
+ { LEAVE_SCOPE($2);
+ $$ = append_list(OP_LINESEQ,
+ (LISTOP*)$1, (LISTOP*)$3);
PL_pad_reset_pending = TRUE;
- if ($1 && $2) PL_hints |= HINT_BLOCK_SCOPE; }
+ if ($1 && $3) PL_hints |= HINT_BLOCK_SCOPE; }
;
/* A "line" in the program */