develooper Front page | perl.perl5.porters | Postings from February 2019

[perl #130585] perl.c:528: perl_destruct: Assertion`PL_scopestack_ix == 1' failed

Thread Next
From:
Tony Cook via RT
Date:
February 12, 2019 23:03
Subject:
[perl #130585] perl.c:528: perl_destruct: Assertion`PL_scopestack_ix == 1' failed
Message ID:
rt-4.0.24-30546-1550012581-1824.130585-15-0@perl.org
On Tue, 12 Feb 2019 01:40:32 -0800, hv wrote:
> On Mon, 11 Feb 2019 21:32:43 -0800, tonyc wrote:
> > On Fri, 20 Jan 2017 06:43:12 -0800, hv wrote:
> > > The scopestack imbalance here occurs because we call sublex_start()
> > > but never a corresponding sublex_done().
> [...]
> > The closing ) is confusing the parser.
> >
> > Patch which *might* fix it (passes all tests in a DEBUGGING build)
> > attached.
> 
> It looks credible to me, and a good solution. What are your concerns
> about it?

Mostly I was confused by the parser doing this:

$ ./perl -Ilib -MO=Deparse -e 'qq/@{s{0}}/'
join $", @s{'0'};
-e syntax OK

while I expected the s{0} to be treated as the beginning of a s///.

> I know very little about the grammar, but I'm curious why "FUNC
> SUBLEXSTART optexpr SUBLEXEND" is in 'term' rather than next to "FUNC
> '(' optexpr ')'" in 'listop' - I'm assuming the cases hitting the
> former with the patch would previously have hit the latter.

This is from the history of the patch.  Originally I had an extra production called sublexexpr that I'd added to term, since first rule I converted to use the new tokens was the '(' expr ')' case for term.

But that rule isn't used - subparses always generate something like the FUNC() call (where FUNC might be op_stringify for "..."), and I ended up adding the FUNC rule to sublexexpr too.

Testing found that the {expr} sublex token rule wasn't being used so I removed it, and finally added the remaining rule to term.  Which is probably the wrong place.

> Is it possible to construct an additional croak/toke test for the \U
> case, or does the means of construction imply it cannot trigger
> failure the same way?

I think it can, though I couldn't reproduce it with an unpatched blead.

I've attached an updated patch that moves the rule, and some attempts at making qq() reproduce the problem, though I couldn't make them crash.

Tony


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

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