Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] non-recursive recursive module segfault

0 views
Skip to first unread message

Jeremy Yallop

unread,
Aug 9, 2006, 9:51:13 AM8/9/06
to caml...@inria.fr
What behaviour should I expect for the following code? :

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

Alain Frisch

unread,
Aug 9, 2006, 10:34:57 AM8/9/06
to Jeremy Yallop
Jeremy Yallop wrote:
> What behaviour should I expect for the following code? :
>
> 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.

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

Jeremy Yallop

unread,
Aug 9, 2006, 10:58:52 AM8/9/06
to Alain Frisch
Alain Frisch wrote:
> Jeremy Yallop wrote:
>> What behaviour should I expect for the following code? :
[...]

>
> 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

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.

0 new messages