[ragel-users] Possible bug in Ragel 6.0

Adrian Thurston thurs... at cs.queensu.ca
Wed Mar 5 18:19:52 UTC 2008


Hi Manoj,

Applying kleene star to a machine that accepts the zero length word (has
a start state that is final) requires some special care in the kleene
star operator due to leaving actions. It is this special case that is
failing.

I never really put much effort into solving this because applying kleene
star to something that already accepts nothing is not a great idea. It's
ambiguous and in the presence of leaving actions it's not clear how it
should work. That's why the warning is there. It's better to refactor
your grammar. You could probably take out the optional operation
immediately before the kleene star.

To prevent crashing in the future I'll have to do something here. I
might just remove final state status from the start state before doing a
star operation. The warning will stay in.

-Adrian

Manoj Rajagopalan wrote:
> Hi all,
> 
>    Ragel has been crashing with non-descript errors and I've spent a lot 
> of time trying to find out the cause of the crash. I've made partial 
> progress and would like to inform you about this and could benefit from 
> an expert's help.
> 
>   I'm attaching a ragel file that I'm trying to compile with the command:
> 
>    ragel -C mmp-parser.rl -o mmp-parser.cpp
> 
> The crash is in the front-end and the segfault can be seen with
> 
>    ragel -x mmp-parser.rl
> 
>  From the backtrace, I've been able to see that in the following lines 
> (ragel/fsmgraph.cpp: 226-229)
> 
>      for ( StateSet::Iter st = finStateSet; st.lte(); st++ ) {
>          if ( *st != startState )
>              mergeStatesLeaving( md, *st, startState );
>      }
> 
> the value returned by *st is (StateAp *)0x0, NULL pointer! This is what 
> is causing the segfault.
> 
> So StateSet is a container (a Vector<StateAp*>) with one entry being a 
> NULL pointer. Does someone know how this could creep in?
> 
> Thanks,
> Manoj
> 
> > 
> 



More information about the ragel-users mailing list