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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 0373BBC6C for ; Fri, 18 Jan 2008 18:05:21 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAI5rkEdA6ba9kGdsb2JhbACQFAEBAQEHBAQJChEHlSWHdQ X-IronPort-AV: E=Sophos;i="4.25,217,1199660400"; d="scan'208";a="21484103" Received: from nf-out-0910.google.com ([64.233.182.189]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Jan 2008 18:05:21 +0100 Received: by nf-out-0910.google.com with SMTP id e27so91016nfd.13 for ; Fri, 18 Jan 2008 09:05:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=BMtGQfBTzUO50vDDC4eqGQqrYzuYifnMjWp8ctohjTY=; b=cFL8dLV4gc5vUDhYKne7+cSbbrrfrjEv8vMgDrnkhWP8Lc0pW6Z0hunJJungq5gDeNpVDILs1Of5TeRFYDmpSdw6f/AQCwTHPXIUwMc19aWVIAOvMKT7ZdIPbz8hmzPncM57Od5z588R3/hQGg34eHK/vv63f3rKxENLARgPHWc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=EqOlV2dgE6ZmTrPyGL+sW8NqtPvGhUrSk0xNYvf7hwgTveXcBHHdG6pdjm2z/x+7Px9EHtY/TsxfHCoXI5UbHWvelHeg8qaz8C8SSm/hNdL+9UcmRFuMMvBegs4O0QYA21cqLFz7TBTxxY+z8tej2BprW+HukTiXCrCA0IjDfPQ= Received: by 10.78.100.1 with SMTP id x1mr5071837hub.45.1200675920425; Fri, 18 Jan 2008 09:05:20 -0800 (PST) Received: by 10.78.77.18 with HTTP; Fri, 18 Jan 2008 09:05:20 -0800 (PST) Message-ID: <95513600801180905t2adcaf53u6d5f9c6a5acbd8a6@mail.gmail.com> Date: Fri, 18 Jan 2008 18:05:20 +0100 From: "Olivier Andrieu" Sender: oandrieu@gmail.com To: "Benjamin Canou" Subject: Re: [Caml-list] Strange performances Cc: caml-list@yquem.inria.fr In-Reply-To: <1200675314.6345.32.camel@benjamin-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1200619933.6383.47.camel@benjamin-laptop> <20080118.111503.185813743.garrigue@math.nagoya-u.ac.jp> <9d3ec8300801172339j38bf734dm5b84f951a4342188@mail.gmail.com> <20080118.181206.85503086.garrigue@math.nagoya-u.ac.jp> <1200675314.6345.32.camel@benjamin-laptop> X-Google-Sender-Auth: cd19116724c2db9c X-Spam: no; 0.00; andrieu:01 oandrieu:01 -unsafe:01 ocaml:01 runtime:01 segfault:01 runtime:01 wrote:01 overflows:01 stack:01 stack:01 rec:01 compile:01 exception:01 exception:01 Salut, On Jan 18, 2008 5:55 PM, Benjamin Canou wrote: > This code works perfectly : > > let list_of_string s = > let rec list_of_string s i = > try let e = s.[i] in e :: list_of_string s (succ i) > with Invalid_argument "index out of bounds" -> [] > in list_of_string s 0 well, until you compile with the -unsafe flag .... > Jacques, if I remember well, the ocaml runtime is not able to detect > stack overflows in native code on all platforms, that's why you get a > segfault instead of a Stack overflow exception. indeed, stack overflow of native code is not detected on all platforms. Even on platforms where it is supported, you won't get an exception if the overflow occurs in a function inside the C runtime. -- Olivier