From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 99158BC68 for ; Sun, 15 Oct 2006 17:58:18 +0200 (CEST) Received: from smtp6-g19.free.fr (smtp6-g19.free.fr [212.27.42.36]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9FFwIdQ025706 for ; Sun, 15 Oct 2006 17:58:18 +0200 Received: from [192.168.1.2] (che78-2-82-237-71-191.fbx.proxad.net [82.237.71.191]) by smtp6-g19.free.fr (Postfix) with ESMTP id E73244249E; Sun, 15 Oct 2006 17:58:17 +0200 (CEST) Message-ID: <45325A99.5040400@inria.fr> Date: Sun, 15 Oct 2006 17:58:17 +0200 From: Xavier Leroy User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakob Lichtenberg Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Missing overflow exception message in ocamlopt References: <43CD2D195487A448934920501C6EDB23026B233F@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com> In-Reply-To: <43CD2D195487A448934920501C6EDB23026B233F@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45325A9A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocamlopt:01 byte:01 stack:01 ocamlopt:01 stack:01 cvs:01 behaves:01 overflows:01 overflows:01 macosx:01 macosx:01 compile:01 caml-list:01 exception:01 exception:01 > 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