Dave Mitchell wrote: > > > > > > my ($A, $B); > > > $B = ($A = '' . foo()) . "y"; > > > $D = ($C = '' . foo()) . "y"; > > > print "$A,$B\n"; # xy,xy > > > print "$C,$D\n"; # x,xy > > > > > > sub foo { "x" } > > > > Ouch. > > I can reproduce it with 5.6.1, but not with 5.5.3. > > Looks like an optree optimization problem. > > Both the inner and outer OP_CONCATs have the TEMP target optimised away; > the inner one uses the lexical as the target instead, and the outer one is > STACKED, so it uses the previous result as the target (which happens to be > the lexical). I'm tempted to apply the fix below. (Look closer.) Thoughts ? Index: opcode.pl =================================================================== --- opcode.pl (revision 2824) +++ opcode.pl (working copy) @@ -537,7 +537,7 @@ 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 End of fix.Thread Previous | Thread Next