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