diff --git a/ext/B/t/optree_varinit.t b/ext/B/t/optree_varinit.t index 0d0dc72e435d..25ab49452c17 100644 --- a/ext/B/t/optree_varinit.t +++ b/ext/B/t/optree_varinit.t @@ -405,8 +405,6 @@ checkOptree ( name => 'void context state', # 3 <|> once(other->4)[$:2,3] vK/1 # 4 <$> const[IV 1] s # 5 <1> padsv_store[$x:2,3] vKS/LVINTRO,STATE -# goto 6 -# 8 <0> padsv[$x:2,3] v/STATE # 6 <;> nextstate(main 3 -e:1) v:%,{,fea=15 # 7 <@> leave[1 ref] vKP/REFC EOT_EOT @@ -415,8 +413,6 @@ EOT_EOT # 3 <|> once(other->4)[$:2,3] vK/1 # 4 <$> const(IV 1) s # 5 <1> padsv_store[$x:2,3] vKS/LVINTRO,STATE -# goto 6 -# 8 <0> padsv[$x:2,3] v/STATE # 6 <;> nextstate(main 3 -e:1) v:%,{,fea=15 # 7 <@> leave[1 ref] vKP/REFC EONT_EONT @@ -433,7 +429,7 @@ checkOptree ( name => 'scalar context state', # 5 <0> padsv[$x:2,3] sRM*/LVINTRO,STATE # 6 <2> sassign sKS/2 # goto 7 -# a <0> padsv[$x:2,3] s/STATE +# a <0> padsv[$x:2,3] s # 7 <1> padsv_store[$y:2,3] vKS/LVINTRO # 8 <;> nextstate(main 3 -e:1) v:%,{,fea=15 # 9 <@> leave[1 ref] vKP/REFC @@ -445,7 +441,7 @@ EOT_EOT # 5 <0> padsv[$x:2,3] sRM*/LVINTRO,STATE # 6 <2> sassign sKS/2 # goto 7 -# a <0> padsv[$x:2,3] s/STATE +# a <0> padsv[$x:2,3] s # 7 <1> padsv_store[$y:2,3] vKS/LVINTRO # 8 <;> nextstate(main 3 -e:1) v:%,{,fea=15 # 9 <@> leave[1 ref] vKP/REFC diff --git a/op.c b/op.c index 996d3439da07..94ccc3080c6b 100644 --- a/op.c +++ b/op.c @@ -2257,9 +2257,19 @@ Perl_scalarvoid(pTHX_ OP *arg) case OP_ASLICE: case OP_HELEM: case OP_HSLICE: - if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))) - /* Otherwise it's "Useless use of grep iterator" */ - useless = OP_DESC(o); + if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))) { + if ((op_parent(o)->op_type == OP_ONCE) && + (op_parent(o)->op_next == o) + ){ + /* An already set "state" OP has been encounted + * and there's no point pushing anything to the + * stack in void context. */ + op_parent(o)->op_next = o->op_next; + } else { + /* Otherwise it's "Useless use of grep iterator" */ + useless = OP_DESC(o); + } + } break; case OP_SPLIT: @@ -8597,8 +8607,8 @@ S_newONCEOP(pTHX_ OP *initop, OP *padop) { const PADOFFSET target = padop->op_targ; OP *const nexop = newOP(padop->op_type, - (padop->op_flags & ~(OPf_REF|OPf_MOD|OPf_SPECIAL)) - | ((padop->op_private & ~OPpLVAL_INTRO) << 8)); + (padop->op_flags & ~(OPf_REF|OPf_MOD|OPf_SPECIAL|OPf_WANT)) + | ((padop->op_private & ~(OPpLVAL_INTRO|OPpPAD_STATE)) << 8)); OP *const first = newOP(OP_NULL, 0); OP *const nullop = newCONDOP(0, first, initop, nexop); /* XXX targlex disabled for now; see ticket #124160 diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 16e65e39eeff..25d45bae8dbd 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -5,15 +5,15 @@ [ this is a template for a new perldelta file. Any text flagged as XXX needs to be processed before release. ] -perldelta - what is new for perl v5.41.6 +perldelta - what is new for perl v5.41.7 =head1 DESCRIPTION -This document describes differences between the 5.41.5 release and the 5.41.6 +This document describes differences between the 5.41.6 release and the 5.41.7 release. -If you are upgrading from an earlier release such as 5.41.4, first read -L, which describes differences between 5.41.4 and 5.41.5. +If you are upgrading from an earlier release such as 5.41.5, first read +L, which describes differences between 5.41.5 and 5.41.6. =head1 Notice @@ -91,23 +91,6 @@ There may well be none in a stable release. XXX -=item * - -Code that uses the C function from the L module to generate -a list of index/value pairs out of array which is then passed into a -two-variable C list to unpack those again is now optimised to be more -efficient. - - my @array = (...); - - foreach my ($idx, $val) (builtin::indexed @array) { - ... - } - -In particular, a temporary list twice the size of the original -array is no longer generated. Instead, the list iterates down the array -in-place directly, in the same way that C would do. - =back =head1 Modules and Pragmata @@ -146,31 +129,6 @@ L has been upgraded from version A.xx to B.yy. XXX If there was something important to note about this change, include that here. -=item * - -L has been upgraded from version 1.23 to 1.24. -L has been upgraded from version 1.07 to 1.08. - -There is now a way to pass lexical filehandles to child processes directly -(instead of having the module create a pipe internally). Previously, only -bareword filehandles could be used in "dup mode". - -=item * - -L has been upgraded from version 1.62 to 1.63. - -The complex number parser for string inputs has been improved. In particular, -C<1+i>, C<123i>, C, C<-inf>, C, and C<-infi> are now handled -correctly. - -=item * - -L has been upgraded from version 1.78 to 1.79. - -It now retains parens around logical negations on the left-hand side of -comparisons (such as C<(!$x) == $y>) because omitting them would trigger a -C warning since perl v5.41.4. [GH #22661] - =back =head2 Removed Modules and Pragmata @@ -372,19 +330,9 @@ L section. =over 4 -=item arm64 DARWIN - -Fix arm64 darwin hints when using use64bitall with Configure [GH #22672] - -=item Android - -Changes to perl_langinfo.h for Android [GH #22650] related to [GH #22627] - -=item Cygwin - -cygwin.c: fix several silly/terrible C errors [GH #22724] +=item XXX-some-platform -workaround DLL load address conflict [GH #22696] +XXX =back @@ -400,16 +348,7 @@ well. =item * -Enable removing most of mathoms.c and stub functions [GH #22691] and [GH #22714] - -=item * - -reinstate apostrophe as package separator behind a default enabled feature, -which is disabled from feature bundle 5.41. - -=item * - -pp_reverse: don't COW buffer just to then un-COW it [GH #22729] +XXX =back @@ -427,20 +366,6 @@ manager will later use a regex to expand these into links. =item * -The perl parser would erroneously parse like C<=cut> some other POD directives -whose names start with I, prematurely terminating an embedded POD section. -The following cases were affected: I followed by a digit (e.g. -C<=cut2studio>), I followed by an underscore (e.g. C<=cut_grass>), and in -string C, any identifier starting with I (e.g. C<=cute>). -[GH #22759] - -=item * - -Builds with C<-msse> and quadmath on 32-bit x86 systems would crash -with a misaligned access early in the build. [GH #22577] - -=item * - Declaring a lexically scoped array or hash using C within a subroutine and then immediately returning no longer triggers a "Bizarre copy of HASH/ARRAY in subroutine exit" error. [GH #18630] @@ -459,22 +384,7 @@ platform specific bugs also go here. =item * -C builds may fail during testing due to a conflict between the -load addresses of F and -F. This will also be visible -for anything that attempts to fork() with C loaded. - -This is known to fail for builds with options that increase the size -of the binary, such as C<-DDEBUGGING>, C<-Doptimize="-O0 -g"> or -C<-Doptimize="-O2 -g -march=x86-64-v2">. - -This can be avoided by building perl with -C<-Astatic_ext=I18N/Langinfo>. - -The base addresses are generated by the linker based on the names of -the DLLs, so this is expected to clear up for 5.41.7. - -[github #22695] +XXX =back @@ -498,7 +408,7 @@ died, add a short obituary here. XXX Generate this with: - perl Porting/acknowledgements.pl v5.41.5..HEAD + perl Porting/acknowledgements.pl v5.41.6..HEAD =head1 Reporting Bugs diff --git a/t/op/state.t b/t/op/state.t index 99b4a49b65bf..1c0b0a81fecd 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -9,7 +9,7 @@ BEGIN { use strict; -plan tests => 164; +plan tests => 166; # Before loading feature.pm, test it with CORE:: ok eval 'CORE::state $x = 1;', 'CORE::state outside of feature.pm scope'; @@ -509,10 +509,12 @@ for (1,2) { sub gh_18630H {state %h=(a=>1)} my $res = join '', gh_18630H, gh_18630H; is($res, "a1a1", 'HASH copied successfully in subroutine exit'); + is(scalar gh_18630H, 1, 'gh_18630H scalar call returns key count'); sub gh_18630A {state @a = qw(b 2)} $res = join '', gh_18630A , gh_18630A; is($res, "b2b2", 'ARRAY copied successfully in subroutine exit'); + is(scalar gh_18630A, 2, 'gh_18630A scalar call returns element count'); } __DATA__