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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6A78CBC0A for ; Fri, 17 Nov 2006 16:01:39 +0100 (CET) Received: from mx-serv.inrialpes.fr (mx-serv.inrialpes.fr [194.199.18.100]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kAHF1cBc026400 for ; Fri, 17 Nov 2006 16:01:39 +0100 Received: from smtps.inrialpes.fr (smtps.inrialpes.fr [194.199.18.58]) by mx-serv.inrialpes.fr (8.13.6/8.13.0) with ESMTP id kAHF1Ywj025121 for ; Fri, 17 Nov 2006 16:01:34 +0100 (MET) Received: from [128.93.8.130] (macadam.inria.fr [128.93.8.130]) (authenticated bits=0) by smtps.inrialpes.fr (8.13.7/8.13.4) with ESMTP id kAHF1Z3U030281 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 17 Nov 2006 16:01:35 +0100 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <6dbd4d000610241846g5a19a56u4630c7b10e5fbffb@mail.gmail.com> References: <6dbd4d000610241846g5a19a56u4630c7b10e5fbffb@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Trouble with doubly-linked, circular list using lazy evaluation Date: Fri, 17 Nov 2006 16:02:31 +0100 To: OCaml Mailing List X-Mailer: Apple Mail (2.752.2) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (mx-serv.inrialpes.fr [194.199.18.100]); Fri, 17 Nov 2006 16:01:34 +0100 (MET) X-mx-serv-inrialpes-fr-MailScanner-Information: Please contact postmaster@inrialpes.fr for more information X-mx-serv-inrialpes-fr-MailScanner: Found to be clean X-mx-serv-inrialpes-fr-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=0, requis 5) X-mx-serv-inrialpes-fr-MailScanner-From: damien.doligez@inria.fr X-Miltered: at concorde with ID 455DCED3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; damien:01 damien:01 pointers:01 uname:01 powerpc:01 ocaml:01 bug:01 bug:01 toplevel:01 46,:98 2.5:98 ford:98 doligez:01 doligez:01 wrote:01 On 2006-10-25, at 03:46, Denis Bueno wrote: > I get a "Bus error" when running a unit test on a doubly-linked > circular list (of length 2). A self-contained test case is included > [1]. I have 8 fields in a record which includes two left & right > pointers (not ref types). > > I am running a PowerMac G5 2.5GHz (uname -a: Darwin ford.local 8.8.0 > Darwin Kernel Version 8.8.0: Fri Sep 8 17:18:57 PDT 2006; > root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc) and > ocaml 3.09.3. > > Interestingly, if I remove a field (such as the mark field), the test > case succeeds. That was an interesting bug. Thanks for reporting it. It has nothing to do with lazy values: it's an interference between "let rec" of values and an optimization in the implementation of the { ... with ... } construct. To work around the bug, you can remove all instances of let rec ... = { ... with ... } (i.e. the "with" construct as the toplevel expression of a letrec-bound variable) by expanding the "with" construct by hand. I am fixing it in the 3.09 branch (3.09.4+dev1). -- Damien