Browse thread
Obj.dup crash ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-12-30 (21:48) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] Obj.dup crash ? |
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