https://github.com/agarwal/ocaml402_error

The above link contains a simple program that segfaults when compiling with ocamlopt 4.02. Byte code doesn't segfault, nor does native code with 4.01.

This is the minimal example I could come up with. It uses atdgen and is sensitive to the exact fields in the .atd file. Removing any of the fields leads to correctly functioning code.

I've only tested on Mac OS X so far.

In the context of my full code, I observed another behavior also. Instead of a segfault, I would get random non-ascii characters printed for the value of postgres.host, and it would be different on repeated runs of the program (I didn't even recompile in between). I can't seem to reproduce this behavior, only getting the segfault now.