Fix handling left-hand-side undef when assigning a list
This commit is contained in:
parent
212e2739b3
commit
d6f9e4d2d3
@ -0,0 +1,71 @@
|
|||||||
|
From 282d9dfeb4cea3c2d0335ba78faa3a9db931f1ec Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Mitchell <davem@iabyn.com>
|
||||||
|
Date: Tue, 11 Aug 2020 13:58:51 +0100
|
||||||
|
Subject: [PATCH] list assign in list context: honour LHS undef
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
GH #16685
|
||||||
|
|
||||||
|
In
|
||||||
|
|
||||||
|
@a = ($x, undef, undef) = (1))
|
||||||
|
|
||||||
|
@a should have 3 elements. v5.25.6-79-gb09ed995ad broke this and was
|
||||||
|
returning one element.
|
||||||
|
|
||||||
|
The fix is simple: that previous commit made it so that elements were
|
||||||
|
pushed back onto the stack only if they weren't immortal, so
|
||||||
|
&PL_sv_undef was getting skipped. Make it so they always are.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
pp_hot.c | 2 +-
|
||||||
|
t/op/aassign.t | 10 +++++++++-
|
||||||
|
2 files changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pp_hot.c b/pp_hot.c
|
||||||
|
index e9f1ffe7a4..3564dd7e12 100644
|
||||||
|
--- a/pp_hot.c
|
||||||
|
+++ b/pp_hot.c
|
||||||
|
@@ -2743,8 +2743,8 @@ PP(pp_aassign)
|
||||||
|
if (!SvIMMORTAL(lsv)) {
|
||||||
|
sv_set_undef(lsv);
|
||||||
|
SvSETMAGIC(lsv);
|
||||||
|
- *relem++ = lsv;
|
||||||
|
}
|
||||||
|
+ *relem++ = lsv;
|
||||||
|
break;
|
||||||
|
} /* switch */
|
||||||
|
} /* while */
|
||||||
|
diff --git a/t/op/aassign.t b/t/op/aassign.t
|
||||||
|
index 9128f9fd98..aa1f2c722c 100644
|
||||||
|
--- a/t/op/aassign.t
|
||||||
|
+++ b/t/op/aassign.t
|
||||||
|
@@ -595,7 +595,7 @@ SKIP: {
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
- # GH #17816
|
||||||
|
+ # GH #16685
|
||||||
|
# don't use the "1-arg on LHS can't be common" optimisation
|
||||||
|
# when there are undef's there
|
||||||
|
my $x = 1;
|
||||||
|
@@ -603,5 +603,13 @@ SKIP: {
|
||||||
|
is("@a", "2 1", "GH #17816");
|
||||||
|
}
|
||||||
|
|
||||||
|
+{
|
||||||
|
+ # GH #17816
|
||||||
|
+ # honour trailing undef's in list context
|
||||||
|
+ my $x = 1;
|
||||||
|
+ my @a = (($x, undef, undef) = (1));
|
||||||
|
+ is(scalar @a, 3, "GH #17816");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
|
||||||
|
done_testing();
|
||||||
|
--
|
||||||
|
2.25.4
|
||||||
|
|
@ -221,6 +221,10 @@ Patch30: perl-5.33.0-fix-C-i-obj-where-obj-is-a-lexical.patch
|
|||||||
# in upstream after 5.33.0
|
# in upstream after 5.33.0
|
||||||
Patch31: perl-5.33.0-list-assign-in-list-context-was-over-optimising.patch
|
Patch31: perl-5.33.0-list-assign-in-list-context-was-over-optimising.patch
|
||||||
|
|
||||||
|
# Fix handling left-hand-side undef when assigning a list, GH#16685,
|
||||||
|
# in upstream after 5.33.0
|
||||||
|
Patch32: perl-5.33.0-list-assign-in-list-context-honour-LHS-undef.patch
|
||||||
|
|
||||||
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
|
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
|
||||||
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
|
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
|
||||||
|
|
||||||
@ -4239,6 +4243,7 @@ you're not running VMS, this module does nothing.
|
|||||||
%patch29 -p1
|
%patch29 -p1
|
||||||
%patch30 -p1
|
%patch30 -p1
|
||||||
%patch31 -p1
|
%patch31 -p1
|
||||||
|
%patch32 -p1
|
||||||
%patch200 -p1
|
%patch200 -p1
|
||||||
%patch201 -p1
|
%patch201 -p1
|
||||||
|
|
||||||
@ -4277,6 +4282,7 @@ perl -x patchlevel.h \
|
|||||||
'Fedora Patch29: Fix an IO::Handle spurious error reported for regular file handles (GH#18019)' \
|
'Fedora Patch29: Fix an IO::Handle spurious error reported for regular file handles (GH#18019)' \
|
||||||
'Fedora Patch30: Fix inheritance resolution of lexial objects in a debugger (GH#17661)' \
|
'Fedora Patch30: Fix inheritance resolution of lexial objects in a debugger (GH#17661)' \
|
||||||
'Fedora Patch31: Fix a misoptimization when assignig a list in a list context (GH#17816)' \
|
'Fedora Patch31: Fix a misoptimization when assignig a list in a list context (GH#17816)' \
|
||||||
|
'Fedora Patch32: Fix handling left-hand-side undef when assigning a list (GH#16685)' \
|
||||||
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
|
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
|
||||||
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
|
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
|
||||||
%{nil}
|
%{nil}
|
||||||
@ -6993,6 +6999,7 @@ popd
|
|||||||
* Thu Aug 27 2020 Petr Pisar <ppisar@redhat.com> - 4:5.32.0-462
|
* Thu Aug 27 2020 Petr Pisar <ppisar@redhat.com> - 4:5.32.0-462
|
||||||
- Fix inheritance resolution of lexial objects in a debugger (GH#17661)
|
- Fix inheritance resolution of lexial objects in a debugger (GH#17661)
|
||||||
- Fix a misoptimization when assignig a list in a list context (GH#17816)
|
- Fix a misoptimization when assignig a list in a list context (GH#17816)
|
||||||
|
- Fix handling left-hand-side undef when assigning a list (GH#16685)
|
||||||
|
|
||||||
* Fri Aug 21 2020 Jeff Law <law@redhat.com> - 4:5.32.0-461
|
* Fri Aug 21 2020 Jeff Law <law@redhat.com> - 4:5.32.0-461
|
||||||
- Re-enable LTO
|
- Re-enable LTO
|
||||||
|
Loading…
Reference in New Issue
Block a user