aksr/re1

Instruction stream generated for Alt causes the recursive implementations to segfault

aksr opened this issue · 0 comments

aksr commented

Posted on Jan 28, 2010 by Happy Kangaroo

Segfault generated when the following is run: ./re "a|b" a

The following instructions are generated for the above regexp: 0. split 3, 1 1. any 2. jmp 0 3. save 0 4. split 4, 7 5. char a 6. jmp 8 7. char b 8. save 1 9. match

The full output: Cat(NgStar(Dot), Paren(0, Alt(Lit(a), Lit(b)))) 0. split 3, 1 1. any 2. jmp 0 3. save 0 4. split 4, 7 5. char a 6. jmp 8 7. char b 8. save 1 9. match
2 a

Segmentation fault

I attached a patch that seems to fix the problem.
compile.c.patch.gz