From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id CB3D6BC57 for ; Mon, 15 Nov 2010 20:00:05 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoQEAJQR4UxZELGagWdsb2JhbACicQEWIiK/J4VKBIpX X-IronPort-AV: E=Sophos;i="4.59,201,1288566000"; d="scan'208";a="78679069" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail2-smtp-roc.national.inria.fr with SMTP; 15 Nov 2010 20:00:05 +0100 Received: (qmail 11407 invoked by uid 634); 15 Nov 2010 19:00:05 -0000 X-Spam-Level: * X-Spam-Check-By: dark.recoil.org Received: from freak-0.srg.cl.cam.ac.uk (HELO [192.168.2.28]) (128.232.32.220) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.83) with ESMTPA; Mon, 15 Nov 2010 19:00:04 +0000 Subject: Re: [Caml-list] Causes for segfaults Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Anil Madhavapeddy In-Reply-To: <20101115185016.GC12576@yquem.inria.fr> Date: Mon, 15 Nov 2010 19:00:00 +0000 Cc: caml-list@yquem.inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: References: <384325291.294734.1288998871132.JavaMail.root@zmbs3.inria.fr> <20101106025118.GA23041@yquem.inria.fr> <4CE1792B.3050603@coherentgraphics.co.uk> <157788745.568057.1289846305435.JavaMail.root@zmbs3.inria.fr> <20101115185016.GC12576@yquem.inria.fr> To: Daniel de Rauglaudre X-Mailer: Apple Mail (2.1082) X-Virus-Checked: Checked by ClamAV on dark.recoil.org X-Spam: no; 0.00; segfaults:01 anil:01 anil:01 rauglaudre:01 0100,:01 segfault:01 ocamlopt:01 segfault:01 ocaml:01 runtime:01 runtime:01 esac:01 macos:01 uname:01 uname:01 On 15 Nov 2010, at 18:50, Daniel de Rauglaudre wrote: > On Mon, Nov 15, 2010 at 07:38:25PM +0100, Jamie Brandon wrote: >=20 >> jamie@jamie-aspire:~$ cat > segfault.ml >> let rec ints n =3D n :: ints (n+1) >> let _ =3D ints 0 >> jamie@jamie-aspire:~$ ocamlopt segfault.ml >> jamie@jamie-aspire:~$ ./a.out >> Segmentation fault >=20 > Stack overflow in native code triggers a segmentation fault, indeed. > I think in C, it is the same thing. Not tested in the OCaml runtime > for efficiency purposes, I think. The runtime can detect native stack overflow if the OS supports it. See = the HAS_STACK_OVERFLOW_DETECTION define in the configure script : case "$arch,$system" in = i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx|amd64,m= acosx) echo "System stack overflow can be detected." echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;; *) echo "Cannot detect system stack overflow.";; esac This works great for me on both MacOS X 10.6 and x86_64 Linux. avsm@brolga-0:~$ uname -a Linux brolga-0 2.6.27.29-0.1.1.xs0.1.0.669.1028xen-xcixen #3 SMP Thu Dec = 24 23:39:24 GMT 2009 x86_64 GNU/Linux avsm@click$ uname -a Darwin click.local 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov 5 = 23:19:13 PDT 2010; root:xnu-1504.9.17~1/RELEASE_X86_64 x86_64 avsm@brolga-0:~$ cat > segfault.ml let rec ints n =3D n :: ints (n+1) let _ =3D ints 0 avsm@brolga-0:~$ ocamlopt segfault.ml=20 avsm@brolga-0:~$ ./a.out=20 Fatal error: exception Stack_overflow Take a look at your configure script output to see if it isn't being = detected I guess. There may also be some interaction with your shell = ulimit that forces a SIGSEGV, perhaps. Anil=