I correctly get an exception with OCaml 3.12.1, Core 108.00.02, on Mac OS X 10.7.5.<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 8, 2012 at 12:04 PM, Markus Mottl <span dir="ltr"><<a href="mailto:markus.mottl@gmail.com" target="_blank">markus.mottl@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I've run into a segfault on Mac OS X with a very trivial program that<br>
basically just links with Jane Street Core. Here is the file <a href="http://test.ml" target="_blank">test.ml</a>:<br>
<br>
----------<br>
module X = Core<br>
<br>
let () = [||].(0) <- 42<br>
----------<br>
<br>
You can build it as follows:<br>
<br>
ocamlbuild -use-ocamlfind -cflag -thread -lflag -thread -pkgs core test.native<br>
<br>
Running test.native will give you a segfault. Here is the stack backtrace:<br>
<br>
----------<br>
#0 0x00007fff90fa78a5 in misaligned_stack_error_entering_dyld_stub_binder ()<br>
#1 0x0000000000000103 in ?? ()<br>
#2 0x0000000101c0a088 in pvars ()<br>
#3 0x0000000101bddedd in caml_raise ()<br>
#4 0x0000000101bddf99 in caml_array_bound_error ()<br>
#5 0x00000001019b6aca in .L101 ()<br>
----------<br>
<br>
The program should just raise an exception due to the illegal array<br>
access. Merely raising an exception directly doesn't trigger the<br>
problem. The program won't segfault either if the "module X = Core"<br>
line is commented out, i.e. Core has to be linked in. Other libraries<br>
apparently also don't cause this issue.<br>
<br>
Could another Mac OS X user here please verify the problem? I'm using<br>
OCaml 4.00.1 with Opam and the latest release of Core in there.<br>
<br>
Maybe somebody more knowledgeable about stack alignment and linking<br>
issues on Mac OS X has an idea what's going wrong here. I suspect<br>
it's a code generation, linking or even runtime issue that may need to<br>
be fixed in the compiler. Or there could be a bug in some module<br>
initialization in Core that is using C-bindings (less likely, I'm not<br>
aware of anything that could cause this).<br>
<br>
Regards,<br>
Markus<br>
<br>
--<br>
Markus Mottl <a href="http://www.ocaml.info" target="_blank">http://www.ocaml.info</a> <a href="mailto:markus.mottl@gmail.com">markus.mottl@gmail.com</a><br>
</blockquote></div><br></div>