ocamlyacc segfault triggered by ocaml-menhir's parser

2017-02-21 Thread Stuart Henderson
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 = 
varsetsize = 1
#1  0x1990ce60372f in generate_states () at lr0.c:155
No locals.
#2  0x1990ce604215 in main (argc=2, argv=0x7f7d69f8) 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?



Re: ocamlyacc segfault triggered by ocaml-menhir's parser

2017-02-21 Thread Christian Weisgerber
On 2017-02-21, Stuart Henderson  wrote:

> 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:

This occasional segfault happens on amd64, too.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: ocamlyacc segfault triggered by ocaml-menhir's parser

2017-02-22 Thread Daniel Dickman
On Tue, Feb 21, 2017 at 5:59 AM, Stuart Henderson  wrote:
> 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:

Pretty nice detective work -- I'd never seen this segfault before.

I checked with the previous version of ocaml-menhir that was in the
tree (20160303) and it has the same behaviour. So the recent update
doesn't look like it introduced a regression.

>
> $ 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 = 
> varsetsize = 1
> #1  0x1990ce60372f in generate_states () at lr0.c:155
> No locals.
> #2  0x1990ce604215 in main (argc=2, argv=0x7f7d69f8) 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?
>

I guess avsm@ might good to talk to. I've cc'd him on this thread. I
also bcc'd Francois Pottier (ocaml menhir upstream) in case he has any
interest in this thread.

p.s. I did a local update of ocaml from 4.03.0 to 4.04.0 to see if
anything's changed, but unfortunately doesn't seem to change much (at
least on my end).