Skip Menu |
Report information
Id: 131207
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: grondilu [at] yahoo.fr
Cc:
AdminCc:

Severity: (no value)
Tag: regex
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: <grondilu [...] yahoo.fr>
Subject: [REGEX] unexpected NFA
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Date: Tue, 25 Apr 2017 00:52:45 +0200
Download (untitled) / with headers
text/plain 466b

$ uname -a

Linux stretch 4.9.0-2-686-pae #1 SMP Debian 4.9.18-1 (2017-03-30) i686 GNU/Linux

$ perl6 --version

This is Rakudo version 2017.04.2-22-g9ed89d947 built on MoarVM version 2017.04

implementing Perl 6.c.

$ cat test.p6

say grammar {

    rule TOP { <foo> | <bar> }

    rule foo { foo ** 2..* % \, }

    rule bar { bar }

}.parse: "foo,foo"

$ perl6 test.p6

Invalid to edge 0 in NFA statelist

  in regex TOP at test.p6 line 2

  in block <unit> at test.p6 line 1

 

This is actually a regression. The code makes sense (more or less), I can't see why would it error out like this.

Bisectable points to (2017-01-31) https://github.com/rakudo/rakudo/commit/9ed4449db57cab39a115c5347387d5978bd56057

On 2017-04-24 15:52:55, grondilu@yahoo.fr wrote:
Show quoted text
> $ uname -a
> Linux stretch 4.9.0-2-686-pae #1 SMP Debian 4.9.18-1 (2017-03-30) i686
> GNU/Linux
> $ perl6 --version
> This is Rakudo version 2017.04.2-22-g9ed89d947 built on MoarVM version
> 2017.04
> implementing Perl 6.c.
> $ cat test.p6
> say grammar {
> rule TOP { <foo> | <bar> }
> rule foo { foo ** 2..* % \, }
> rule bar { bar }
> }.parse: "foo,foo"
> $ perl6 test.p6
> Invalid to edge 0 in NFA statelist
> in regex TOP at test.p6 line 2
> in block <unit> at test.p6 line 1


RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 807b
On Mon, 24 Apr 2017 16:01:19 -0700, alex.jakimenko@gmail.com wrote: Show quoted text
> This is actually a regression. The code makes sense (more or less), I > can't see > why would it error out like this. > > Bisectable points to (2017-01-31) > https://github.com/rakudo/rakudo/commit/9ed4449db57cab39a115c5347387d5978bd56057 >
If it worked before, then it was by luck. The extra sanity check added in MoarVM that produces this message prevented a mis-generated NFA from causing the VM to read junk memory. In some cases, that led to a SEGV. Anyway, the fix will be to figure out where in the NFA generator we are mis-generating things. That ain't the easiest thing to debug, but I will try and take a look at it soon, if I'm not beaten to it. The relevant code is in the NQP repository, under src/QRegex/NFA.nqp. /jnthn


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org