I ran across this in an i386 bulk build, but it's easy to reproduce.
ocamlyacc segfaults when processing the parser from ocaml-menhir-20170101:
$ cd /usr/ports/devel/ocaml-menhir; make
[..]
$ cd `make show=WRKSRC`/src/_stage1
$ for i in `jot 200`; do ocamlyacc parser.mly || echo $i; done
Segmentation fault (core dumped)
39
Segmentation fault (core dumped)
49
Segmentation fault (core dumped)
172
Segmentation fault (core dumped)
180
Output files are zero bytes, backtrace looks like this:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 set_first_derives () at closure.c:109
109 cword = *vrow++;
(gdb) bt full
#0 set_first_derives () at closure.c:109
rrow = 0x199365ec1374
vrow = 0x1992f74b2000
j = 62
mask = 0
cword = 2164277248
rp = 0x20
rule = -1
i = 62
rulesetsize = <optimized out>
varsetsize = 1
#1 0x00001990ce60372f in generate_states () at lr0.c:155
No locals.
#2 0x00001990ce604215 in main (argc=2, argv=0x7f7ffffd69f8) at main.c:456
No locals.
I know very little about OCaml so if someone's interested, could you take
a look and/or report upstream please?