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.7 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 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 3BA43BC6C for ; Mon, 4 Feb 2008 16:07:19 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAOe4pkdCm3xr/2dsb2JhbACrNg X-IronPort-AV: E=Sophos;i="4.25,303,1199660400"; d="scan'208";a="6859985" Received: from janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Feb 2008 16:07:18 +0100 Received: from [172.25.135.136] [38.96.172.125] by janestcapital.com (SMTPD-9.10) id AA24058C; Mon, 04 Feb 2008 10:07:16 -0500 Message-ID: <47A72A24.6010208@janestcapital.com> Date: Mon, 04 Feb 2008 10:07:16 -0500 From: Adam Chlipala User-Agent: Thunderbird 1.5.0.8 (X11/20061107) MIME-Version: 1.0 To: tmp123 Cc: caml-list Subject: Re: [Caml-list] Crash reading a file References: <47A72726.3090503@menta.net> In-Reply-To: <47A72726.3090503@menta.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IMAIL-SPAM-VALFROM: (2a240089000085ba) X-IMAIL-SPAM-VALREVDNS: (2a240089000085ba) X-Spam: no; 0.00; recursive:01 foo:01 stdin:01 pervasives:01 stdin:01 ocamlopt:01 -pp:01 camlp:01 foo:01 sugestion:01 wrote:01 stack:01 stack:01 rec:01 caml-list:01 Your function isn't tail recursive, so it uses stack space proportional to the number of lines in the file. "Segmentation fault" may be your architecture's "stack overflow" error. tmp123 wrote: > The following program (foo.ml): > > value rec read_stdin () = > try > [ (input_line Pervasives.stdin) :: (read_stdin ()) ] > with [ End_of_file -> [] ]; > > value main () = > read_stdin(); > > main(); > > > when compiled with "ocamlopt -pp camlp4r foo.ml" and executed > "./a.out", produces a segmentation fault, but I'm not able to find why. > > Please, has someone any sugestion?