Weird bug on Mac OS X

Anil Madhavapeddy anil at recoil.org
Thu Nov 8 17:47:20 GMT 2012


Looks like another misaligned stack pointer somewhere; two were fixed
already here:
http://caml.inria.fr/mantis/view.php?id=5700

MacOS 10.8 strictly needs a 16-byte aligned stack or else lots of systems
functions decide to throw in the towel (due to them using SSE instructions
by default now).

#0  0x00007fff8e4ad8a5 in misaligned_stack_error_entering_dyld_stub_binder ()
#1  0x0000000000000103 in ?? ()
#2  0x0000000100254068 in caml_absf_mask ()
#3  0x000000010022e923 in caml_raise ()
#4  0x000000010022ec71 in caml_array_bound_error ()
#5  0x000000010000b32a in .L101 ()


-a

On 8 Nov 2012, at 17:16, Markus Mottl <markus.mottl at gmail.com> wrote:

> Should have mentioned that, too: I'm running Mac OS X 10.8.2 with the
> latest XCode version (4.5.2).
> 
> On Thu, Nov 8, 2012 at 12:11 PM, Ashish Agarwal <agarwal1975 at gmail.com> wrote:
>> I correctly get an exception with OCaml 3.12.1, Core 108.00.02, on Mac OS X
>> 10.7.5.
>> 
>> On Thu, Nov 8, 2012 at 12:04 PM, Markus Mottl <markus.mottl at gmail.com>
>> wrote:
>>> 
>>> 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
>> 
>> 
> 
> 
> 
> -- 
> Markus Mottl        http://www.ocaml.info        markus.mottl at gmail.com
> 




More information about the core mailing list