stack overflow in match.c
Closed this issue · 1 comments
andrewchambers commented
Steps to reproduce:
checkout https://github.com/andrewchambers/qc/tree/ec59bd4fa3384eca2b78a577a06955d5a472c3c9
run mbld
ac@black:~/src/qc$ mbld
project base /home/ac/src/qc:
qc...
6m ctypes.myr
6m err.myr
6m ast.myr
6m fold.myr
6m hideset.myr
6m tok.myr
6m cpp.myr
CRASH: "6m cpp.myr"
stack trace says match.c:236:acceptall() is getting into an infinite recursion causing a stack overflow.
The repeating pattern in recursion is about 3 calls deep before looping.
The offending line of code is https://github.com/andrewchambers/qc/blob/ec59bd4fa3384eca2b78a577a06955d5a472c3c9/tok.myr#L22
commenting out the hs struct member in the tok type resolves the infinite loop.
oridb commented
Fixed -- there was a loop being generated in pattern matching because the start state was added to the list of end states.