caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: Jamie Brandon <jamie@scattered-thoughts.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Causes for segfaults
Date: Mon, 15 Nov 2010 23:47:12 +0200	[thread overview]
Message-ID: <20101115234712.16bc8f34@deb0> (raw)
In-Reply-To: <AANLkTinj06=nHz94825C_XwRdiP+TV-c4PaiXtWzwNOb@mail.gmail.com>

On Mon, 15 Nov 2010 18:38:18 +0000
Jamie Brandon <jamie@scattered-thoughts.net> wrote:

> > Excessive recursion of a function does raise an exception, on most
> > platforms, doesn't it?
> 
> [root@senldogo0183 texsearch-development2]# uname -a
> Linux senldogo0183 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007
> x86_64 x86_64 x86_64 GNU/Linux
> [root@senldogo0183 texsearch-development2]# ocaml -version
> The Objective Caml toplevel, version 3.12.0
> [root@senldogo0183 texsearch-development2]# cat > segfault.ml
> let rec ints n = n :: ints (n+1)
> let _ = ints 0
> [root@senldogo0183 texsearch-development2]# ocamlopt segfault.ml
> [root@senldogo0183 texsearch-development2]# ./a.out
> Segmentation fault

I get a proper exception:
Fatal error: exception Stack_overflow

Linux debian 2.6.36-phenom #107 SMP PREEMPT Sat Oct 23 10:30:01 EEST
2010 x86_64 GNU/Linux

Although you have to be careful with recursion and calls to C code,
calling the C code may be the one overflowing the stack, and the ocaml
runtime doesn't generate stack overflow exception for that (only for
OCaml code). You will probably need the patch from
http://caml.inria.fr/mantis/view.php?id=5064 for that.

Best regards,
--Edwin


  reply	other threads:[~2010-11-15 21:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 20:19 Jamie Brandon
2010-11-04 20:25 ` [Caml-list] " Raphael Proust
2010-11-04 20:39   ` Jamie Brandon
2010-11-05 15:54     ` David MENTRE
2010-11-05 22:18     ` oliver
2010-11-04 20:41 ` Till Varoquaux
2010-11-05 23:14   ` Jamie Brandon
     [not found]   ` <384325291.294734.1288998871132.JavaMail.root@zmbs3.inria.fr>
2010-11-06  2:51     ` Daniel de Rauglaudre
2010-11-08 14:26       ` Jamie Brandon
2010-11-08 14:48         ` Till Varoquaux
2010-11-10 15:52           ` Jamie Brandon
2010-11-15 17:58             ` Jamie Brandon
2010-11-15 18:17               ` John Whitington
2010-11-15 18:38                 ` Jamie Brandon
2010-11-15 21:47                   ` Török Edwin [this message]
     [not found]                 ` <157788745.568057.1289846305435.JavaMail.root@zmbs3.inria.fr>
2010-11-15 18:50                   ` Daniel de Rauglaudre
2010-11-15 19:00                     ` Anil Madhavapeddy
2010-11-15 19:08                     ` Norman Hardy
     [not found]                     ` <1795362267.568432.1289847605872.JavaMail.root@zmbs3.inria.fr>
2010-11-15 19:21                       ` Daniel de Rauglaudre

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=20101115234712.16bc8f34@deb0 \
    --to=edwintorok@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jamie@scattered-thoughts.net \
    /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).