module rec M :
sig
val m : unit -> unit
end
=
struct
let h _ _ = ()
let m = h ()
end
let _ = M.m ()
According to the documentation this could trigger the exception
"Undefined_recursive_module", but instead it segfaults. If I remove the
`rec' keyword then it "works", i.e. simply returns unit.
I was rather hoping that M would be treated as a non-recursive module,
despite the `rec', since it's not actually recursive. It's easy enough
to avoid the segmentation fault: eta-expanding m, adding a trivial value
component to the signature, removing `rec', etc., but I was hoping the
compiler would help out in this case.
In any case, should the segmentation fault be considered a bug?
This is on OCaml 3.09.2/Linux/x86.
Jeremy.
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
That's probably the bug 4008:
http://caml.inria.fr/mantis/view.php?id=4008
which is fixed in the 3.09 CVS branch (but not in the 3.10 branch, in
case you tried).
To get rid of the problem, you can either:
- use the CVS version (release309 branch);
- download, compile and link with the following files:
http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/~checkout~/ocaml/stdlib/camlinternalMod.mli?rev=1.1.8.2
http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/~checkout~/ocaml/stdlib/camlinternalMod.ml?rev=1.4.2.1
- use ocamlopt
-- Alain
Thanks! All of the above fixed the problem. I'd looked on mantis to
see if was a known problem, but bug 4008 didn't show up when I searched
for "recursive module" (for obvious reasons).
Jeremy.