caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Jakob Lichtenberg <jakobl@windows.microsoft.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Missing overflow exception message in ocamlopt
Date: Sun, 15 Oct 2006 17:58:17 +0200	[thread overview]
Message-ID: <45325A99.5040400@inria.fr> (raw)
In-Reply-To: <43CD2D195487A448934920501C6EDB23026B233F@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com>

> 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


  parent reply	other threads:[~2006-10-15 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 18:46 Jakob Lichtenberg
2006-10-11 19:03 ` [Caml-list] " Jon Harrop
2006-10-11 19:17   ` Richard Jones
2006-10-11 19:25     ` Gerd Stolpmann
2006-10-11 20:26     ` Jon Harrop
2006-10-11 19:45   ` Jakob Lichtenberg
2006-10-12  1:04     ` Robert Roessler
2006-10-15 15:58 ` Xavier Leroy [this message]
2006-10-16  3:50   ` Jakob Lichtenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45325A99.5040400@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=jakobl@windows.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).