From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 62906BB81 for ; Thu, 30 Dec 2004 22:48:13 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBULmCBi026641 for ; Thu, 30 Dec 2004 22:48:13 +0100 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 WAA25919; Thu, 30 Dec 2004 22:48:12 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBULm9s4026633; Thu, 30 Dec 2004 22:48:11 +0100 Received: from [192.168.1.200] (ppp194-89.lns1.syd2.internode.on.net [203.122.194.89]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id iBULm3RF084793; Fri, 31 Dec 2004 08:18:04 +1030 (CST) Subject: Re: [Caml-list] Obj.dup crash ? From: skaller Reply-To: skaller@users.sourceforge.net To: Nicolas Cannasse Cc: Alain Frisch , caml-list In-Reply-To: <002f01c4ee5f$49820ca0$0100a8c0@warp> References: <025c01c4edab$a708d160$0100a8c0@warp> <41D2D205.5030106@inria.fr> <002001c4edc6$5f2b7e90$0100a8c0@warp> <41D358E2.4000604@inria.fr> <002f01c4ee5f$49820ca0$0100a8c0@warp> Content-Type: text/plain Message-Id: <1104443282.29293.11.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 31 Dec 2004 08:48:03 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41D4779C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41D4779A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 dup:01 sourceforge:01 cannasse:01 wrote:01 dup:01 cvs:01 ocaml:01 glebe:01 ...:98 ...:98 12.:98 061:98 constants:01 expression:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Thu, 2004-12-30 at 22:04, Nicolas Cannasse wrote: > > Concerning Obj.dup, I guess it is never actually called when the block > > has 0 fields. Actually, where is Obj.dup used except in > > CamlinternalOO.copy ? Quick look. It is used in the code generator: > > for array constants of size > 4, and for record expressions { ... with > > ... } that copy the original record and then modify it (but the empty > > record is not a valid type !). So indeed, it seems that Obj.dup is never > > called for 0 fields blocks. The implementation has dead code, but > > it is not buggy ;-) > > It's also used in ExtLib DynArray when copying an array ;) Obj.dup (Obj.magic (Array.make 0 0)); Gc.major();; Warning S: this expression should have type unit. Segmentation fault What's the representation of a 0 length Array? The weird message is due to CVS ocaml 3.09+dev12. Array.copy doesn't exhibit this fault. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net