From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA19574; Thu, 26 Aug 2004 17:44:22 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA18155 for ; Thu, 26 Aug 2004 17:44:21 +0200 (MET DST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i7QFiKTt013078; Thu, 26 Aug 2004 17:44:20 +0200 Received: by yquem.inria.fr (Postfix, from userid 18180) id 7F41CBC21; Thu, 26 Aug 2004 17:44:20 +0200 (CEST) Date: Thu, 26 Aug 2004 17:44:20 +0200 From: Xavier Leroy To: "S. Ted Sandler" Cc: caml-list@inria.fr Subject: Re: [Caml-list] strange tail recursion behavior by caml compiler Message-ID: <20040826154420.GA3976@yquem.inria.fr> References: <20040825195704.GA11359@red.seas.upenn.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040825195704.GA11359@red.seas.upenn.edu> User-Agent: Mutt/1.3.28i X-Miltered: at concorde with ID 412E0554.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 recursion:01 ocamlopt:01 compiler:01 caml:01 overflow:02 overflow:02 stack:02 stack:02 recursive:03 behavior:03 tail:03 tail:03 exceptions:04 asm:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > So here's the problem. When I write listbest like > this, it's not tail recursive. I get stack overflow > exceptions on long lists: Your two versions of listbest are both tail-recursive, even on a register-starved x86 processor, as shown by a quick look at the asm generated by ocamlopt. Either you've simplified your code a little too much before posting, or the stack overflow comes from elsewhere in your code. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners