summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRick Delaney <rick@consumercontact.com>2005-06-19 05:47:22 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-06-20 09:06:57 +0000
commitdbfe47cffca44e11296e0f81e2a3b0d4458a8ba4 (patch)
tree83294a2569a5421db0d802f63d961ab2a4ed41d2 /op.c
parentcb4415b833301d0ffacb0772b2914f6cd6acc2f8 (diff)
downloadperl-dbfe47cffca44e11296e0f81e2a3b0d4458a8ba4.tar.gz
Re: [PATCH replacement] Re: [perl #36313] perl -e "1for$[=0" crash
Message-ID: <20050619134722.GB31592@localhost.localdomain> p4raw-id: //depot/perl@24901
Diffstat (limited to 'op.c')
-rw-r--r--op.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/op.c b/op.c
index 814b07d67d..b06267869f 100644
--- a/op.c
+++ b/op.c
@@ -3274,14 +3274,15 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
OP *curop;
PL_modcount = 0;
- PL_eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
+ /* Grandfathering $[ assignment here. Bletch.*/
+ /* Only simple assignments like C<< ($[) = 1 >> are allowed */
+ PL_eval_start = (left->op_type == OP_CONST) ? right : 0;
left = mod(left, OP_AASSIGN);
if (PL_eval_start)
PL_eval_start = 0;
- else {
- op_free(left);
- op_free(right);
- return Nullop;
+ else if (left->op_type == OP_CONST) {
+ /* Result of assignment is always 1 (or we'd be dead already) */
+ return newSVOP(OP_CONST, 0, newSViv(1));
}
/* optimise C<my @x = ()> to C<my @x>, and likewise for hashes */
if ((left->op_type == OP_PADAV || left->op_type == OP_PADHV)
@@ -3418,8 +3419,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
if (PL_eval_start)
PL_eval_start = 0;
else {
- op_free(o);
- return Nullop;
+ o = newSVOP(OP_CONST, 0, newSViv(PL_compiling.cop_arybase));
}
}
return o;