Bug (segmentation fault) in the generation of counterexamples

"Bartkowiak, Michal (Nokia - PL/Wroclaw)" <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <VI1PR07MB48771E788E1CE01E872F60BDEED10@VI1PR07MB4877.eurprd07.prod.outlook.com>
Hello,

I believe there is a bug in the code that generates counterexamples. I am using Bison to generate parser from some proprietary grammar and it is running normally and generating desired output in regular case. But when I want to generate debug information with command line options " --report=counterexamples --report-file=out.txt" then Bison terminates with segmentation fault. I have built debug version of Bison 3.7.4 (I have passed CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" into Bison's configure) and generated core file which I am attaching to this e-mail. 

Running Bison under gdb also points that the segmentation fault might be related to generation of counterexamples report:

Program received signal SIGSEGV, Segmentation fault.
0x0000555555578631 in eligible_state_items (target=0x7ffff74bd500) at src/lssi.c:140
140	      BITSET_FOR_EACH (biter, rsi, sin, 0)
(gdb) bt
#0  0x0000555555578631 in eligible_state_items (target=0x7ffff74bd500) at src/lssi.c:140
#1  0x0000555555578721 in shortest_path_from_start (target=965, next_sym=11) at src/lssi.c:155
#2  0x00005555555678b3 in counterexample_report (itm1=965, itm2=968, next_sym=11, shift_reduce=false, out=0x5555558151b0, prefix=0x5555555e55f2 "    ") at src/counterexample.c:1240
#3  0x000055555556813c in counterexample_report_reduce_reduce (itm1=965, itm2=968, conflict_syms=0x5555557e6bb0, out=0x5555558151b0, prefix=0x5555555e55f2 "    ") at src/counterexample.c:1335
#4  0x0000555555568491 in counterexample_report_state (s=0x5555557cec20, out=0x5555558151b0, prefix=0x5555555e55f2 "    ") at src/counterexample.c:1379
#5  0x000055555559a6ee in print_state (out=0x5555558151b0, s=0x5555557cec20) at src/print.c:364
#6  0x000055555559ad47 in print_results () at src/print.c:471
#7  0x0000555555579756 in main (argc=7, argv=0x7fffffffe1b8) at src/main.c:178

I hope that it would be possible to debug the problem with attached core file. If not, please let me know and I will try to provide more information about the grammar (some minimal example) I am using to generate the problem.

Best regards,
Michal Bartkowiak
bison-core.tar.gz (application/x-gzip, 739.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.