develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [perl #24508] Wrong assignment in nested assignment together with subroutine ca ll

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
November 18, 2003 04:58
Subject:
Re: [perl #24508] Wrong assignment in nested assignment together with subroutine ca ll
Message ID:
20031118135541.41e2ad61.rgarcia@hexaflux.com
Jeff 'japhy' Pinyan wrote:
> 
> This only happens with lexicals.
> 
>   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.
Andreas, could you try this below with binsearchaperl ?

#!perl
sub foo { "x" }
my ($A, $B);
$B = ($A = '' . foo()) . "y";
print "$A,$B" eq "x,xy" ? "ok\n" : "not ok\n";
__END__

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About