Hi Xavier,
 
Thanks for letting me know about this. I am sorry to say that I do not have a deep understanding of the topic, but if I am able to dig anything up I'll let you know.
 
- Jakob


From: Xavier Leroy [mailto:Xavier.Leroy@inria.fr]
Sent: Sun 10/15/2006 8:58 AM
To: Jakob Lichtenberg
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Missing overflow exception message in ocamlopt

> When I compile the following program as byte code I see a stack overflow
> (expected).  When using ocamlopt it seems that the program dies and I do
> not see the expected overflow exception?
>  [under Windows]

Right.  Given your e-mail address, you might actually understand
better than I why it is so.  Let me explain:

The machine code generated by ocamlopt does not test explicitly for
stack overflows, relying instead on the operating system to detect and
report them.  However, handling of stack overflow conditions varies
greatly between processors and operating systems.  Currently:

- Under Linux/IA32 and Linux/AMD64, stack overflows are properly
  turned into a Stack_overflow Caml exception.  Similar handling is
  in the CVS for MacOSX/PPC, and MacOSX/Intel might be feasible soon.

- Other Unix-like operating systems just report stack overflows
  as a "segmentation violation" or "bus error" fatal signal.

- Windows, as you noticed, behaves strangely.  Stack overflows are turned
  into Win32 system exceptions, but apparently the structured
  exception handling of Win32 just fails to handle them and silently
  exits the program.  That might be because the stack frames generated
  by ocamlopt are nothing like what Win32 expects.

If you happen to know how to do better under Windows, you're most
welcome to let me know.

- Xavier Leroy