summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-19 21:06:01 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-19 21:06:01 +0000
commit9133b6393363c0c6671c1b2c6b2ecadb3ff402ee (patch)
treee5733590379b01e4b042c5c8b61a3bce38c468c1
parent1388f78e6435bdc1f8dfb795b726c64c719a88aa (diff)
downloadperl-9133b6393363c0c6671c1b2c6b2ecadb3ff402ee.tar.gz
Fix bug [perl #24508] Wrong assignment in nested assignment
together with subroutine call Apparently concat still doesn't deal correctly with lexicals in all cases. Disable the whole TARGET_MY optimisation for it. (and remove the corresponding code from the peephole optimiser.) p4raw-id: //depot/perl@21752
-rw-r--r--op.c17
-rw-r--r--opcode.h2
-rwxr-xr-xopcode.pl2
-rw-r--r--t/op/concat.t10
4 files changed, 11 insertions, 20 deletions
diff --git a/op.c b/op.c
index 59df02c3f3..58239747fa 100644
--- a/op.c
+++ b/op.c
@@ -6264,23 +6264,6 @@ Perl_peep(pTHX_ register OP *o)
o->op_seq = PL_op_seqmax++;
break;
- case OP_CONCAT:
- if (o->op_next && o->op_next->op_type == OP_STRINGIFY) {
- if (o->op_next->op_private & OPpTARGET_MY) {
- if (o->op_flags & OPf_STACKED) /* chained concats */
- goto ignore_optimization;
- else {
- /* assert(PL_opargs[o->op_type] & OA_TARGLEX); */
- o->op_targ = o->op_next->op_targ;
- o->op_next->op_targ = 0;
- o->op_private |= OPpTARGET_MY;
- }
- }
- op_null(o->op_next);
- }
- ignore_optimization:
- o->op_seq = PL_op_seqmax++;
- break;
case OP_STUB:
if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
o->op_seq = PL_op_seqmax++;
diff --git a/opcode.h b/opcode.h
index 4de3dee137..4d41ddf53c 100644
--- a/opcode.h
+++ b/opcode.h
@@ -1544,7 +1544,7 @@ EXT U32 PL_opargs[] = {
0x0002251e, /* i_add */
0x0002252e, /* subtract */
0x0002251e, /* i_subtract */
- 0x0002250e, /* concat */
+ 0x0002240e, /* concat */
0x0000290e, /* stringify */
0x0002250e, /* left_shift */
0x0002250e, /* right_shift */
diff --git a/opcode.pl b/opcode.pl
index e13d14de25..270e1549ce 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -537,7 +537,7 @@ add addition (+) ck_null IfsT2 S S
i_add integer addition (+) ck_null ifsT2 S S
subtract subtraction (-) ck_null IfsT2 S S
i_subtract integer subtraction (-) ck_null ifsT2 S S
-concat concatenation (.) or string ck_concat fsT2 S S
+concat concatenation (.) or string ck_concat fst2 S S
stringify string ck_fun fsT@ S
left_shift left bitshift (<<) ck_bitop fsT2 S S
diff --git a/t/op/concat.t b/t/op/concat.t
index 97a52005a1..865a498f22 100644
--- a/t/op/concat.t
+++ b/t/op/concat.t
@@ -18,7 +18,7 @@ sub ok {
return $ok;
}
-print "1..19\n";
+print "1..20\n";
($a, $b, $c) = qw(foo bar);
@@ -109,3 +109,11 @@ sub beq { use bytes; $_[0] eq $_[1]; }
my $a; ($a .= 5) . 6;
ok($a == 5, '($a .= 5) . 6 - present since 5.000');
}
+
+{
+ # [perl #24508] optree construction bug
+ sub strfoo { "x" }
+ my ($x, $y);
+ $y = ($x = '' . strfoo()) . "y";
+ ok( "$x,$y" eq "x,xy", 'figures out correct target' );
+}