Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

unexpected NFA #6208

Open p6rt opened 7 years ago

p6rt commented 7 years ago

Migrated from rt.perl.org#131207 (status was 'open')

Searchable as RT131207$

p6rt commented 7 years ago

From @grondilu

$ 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 { \ | \ }   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 \ at test.p6 line 1

p6rt commented 7 years ago

From @AlexDaniel

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​:

$ 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 { \ | \ } 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 \ at test.p6 line 1

p6rt commented 7 years ago

The RT System itself - Status changed from 'new' to 'open'

p6rt commented 7 years ago

From @jnthn

On Mon, 24 Apr 2017 16​:01​:19 -0700, alex.jakimenko@​gmail.com wrote​:

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