New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misparsed nested assignment of expression to lexical #1169
Comments
From jtobey@ne.mediaone.netThis is a bug report for perl from jtobey@feynman.localnet, The following program unexpectedly prints "undefined": my ($x, $y); This behavior affects Perl 5.00563 and 5.5.560, but not 5.00503. The deparsed output is interesting: $ perl -MO=Deparse -e 'my ($x, $y); $x = $y = 1 + $z;' -John Site configuration information for perl v5.5.650: Configured by jtobey at Fri Feb 11 02:13:31 EST 2000. Summary of my perl5 (revision 5.0 version 5 subversion 650) configuration: Locally applied patches: @INC for perl v5.5.650: Environment for perl v5.5.650: |
From [Unknown Contact. See original ticket]John Tobey writes:
Oups, the optimizer was removing the assignment *twice* for the same Sorry, Inline Patch--- ./t/op/lex_assign.t~ Sun Jan 2 15:44:26 2000
+++ ./t/op/lex_assign.t Fri Feb 11 17:46:25 2000
@@ -24,7 +24,7 @@ sub subb {"in s"}
@INPUT = <DATA>;
@simple_input = grep /^\s*\w+\s*\$\w+\s*[#\n]/, @INPUT;
-print "1..", (9 + @INPUT + @simple_input), "\n";
+print "1..", (10 + @INPUT + @simple_input), "\n";
$ord = 0;
sub wrn {"@_"}
@@ -95,6 +95,18 @@ print "ok $ord\n";
print "ok $ord\n";
}
+
+# Chains of assignments
+
+my ($l1, $l2, $l3, $l4);
+my $zzzz = 12;
+$zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 1 + $zzzz;
+
+$ord++;
+print "# $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 13\nnot "
+ unless $zzz1 == 13 and $zzz2 == 13 and $l1 == 13
+ and $l2 == 13 and $l3 == 13 and $l4 == 13;
+print "ok $ord\n";
for (@INPUT) {
$ord++;
--- ./op.c~ Tue Feb 1 15:29:47 2000
+++ ./op.c Fri Feb 11 17:28:53 2000
@@ -5694,7 +5694,9 @@ Perl_ck_sassign(pTHX_ OP *o)
OP *kid = cLISTOPo->op_first;
/* has a disposable target? */
if ((PL_opargs[kid->op_type] & OA_TARGLEX)
- && !(kid->op_flags & OPf_STACKED))
+ && !(kid->op_flags & OPf_STACKED)
+ /* Cannot steal the second time! */
+ && !(kid->op_private & OPpTARGET_MY))
{
OP *kkid = kid->op_sibling;
|
Migrated from rt.perl.org#2137 (status was 'resolved')
Searchable as RT2137$
The text was updated successfully, but these errors were encountered: