develooper Front page | perl.perl5.porters | Postings from August 2017

[perl #124368] Perl_sv_2pv_flags: Assertion`((svtype)((sv)->sv_flags & 0xff)) != SVt_PVAV && ((svtype)((sv)->sv_flags &0xff)) != SVt_PVHV && ((svtype)((sv)->sv_flags & 0xff)) != SVt_PVFM' failed

From:
Tony Cook via RT
Date:
August 14, 2017 06:34
Subject:
[perl #124368] Perl_sv_2pv_flags: Assertion`((svtype)((sv)->sv_flags & 0xff)) != SVt_PVAV && ((svtype)((sv)->sv_flags &0xff)) != SVt_PVHV && ((svtype)((sv)->sv_flags & 0xff)) != SVt_PVFM' failed
Message ID:
rt-4.0.24-28200-1502692457-288.124368-15-0@perl.org
On Mon, 03 Jul 2017 19:04:51 -0700, tonyc wrote:
> On Fri, 08 May 2015 13:58:07 -0700, davem wrote:
> > This is fixable, but first we need to agree on what the semantics
> > should
> > be, in particular, in the following:
> >
> > for (...) {
> >     /abc/o;
> >     /$expr/;
> > }
> >
> > on executing /$expr/ if $expr evaluates to the null string, should it
> > honour the //o of the previous successful match, and so skip
> > evaluating
> > $expr on subsequent iterations? This would be hard to implement.
> >
> > Conversely, should /$expr/o honour the //o flag even if $expr is
> > null?
> >
> > My opinion is that, like c and g, the o flag should be honoured on
> > the
> > match op it appears on, not on the last successful match op, and we
> > fix
> > the docs (as well as the code).
> >
> > So I propose that:
> >
> > /abc/o; $foo =~ /$null/
> >
> > matches $foo against "abc" each time round the loop (it currently
> > crashes
> > on the second iteration); and that:
> 
> It wasn't clear to me from your post, but this actually behaves
> differently between threaded and non-threaded builds - for threaded
> builds it behaves as you describe above - /o is honoured on the op
> with /o and isn't inherited by and empty match without the /o.
> 
> >
> > /abc/; $foo =~ /$null/o
> >
> > always only evaluates $null once; if that happens to be the empty
> > string,
> > then subsequent iterations will see the empty string each time and so
> > each
> > time use the last successful match, which may be /abc/ (it currently
> > ignores the //o on the first iteration if $null is empty).
> >
> > Note that nothing in the test suite currently tests these cases as
> > far
> > as
> > I can tell.
> 
> The attached covers both these cases, I think.

Applied as 3cb4cde3dd4d2af2f5065053905708bffa5168f9.

Tony


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=124368



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