Version française
Home     About     Download     Resources     Contact us    
Browse thread
Bug in ocamlc or in ocamlrun.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] Bug in ocamlc or in ocamlrun.
From: Marc Lasson <titmarc@free.fr>
Subject: [Caml-list] Bug in ocamlc or in ocamlrun.
Date: Wed, 19 Apr 2006 01:16:27 +0200

> When i compile the following program with ocamlc i get a segmentation fault. 
> 
> Is it a bug in the ocaml system ? I did not succeed to isolate it.
>                                  ----------------------
> module LL (R : sig
>  type t
>  val add : t -> t -> t
> end) =
>  struct
>    type t = R.t list
>    let add = List.map2 (R.add)
>  end
> 
> module rec M : sig
>    type t = P of int | L of LS.t
>    val add : t -> t -> t
>    val to_string : t -> string
>  end = struct
>    type param = ()
>    type t = P of int
>                | L of LS.t
>              let add a b = match a, b with
>      P a', P b' -> P (a'+b')
>    | L a', L b' -> L (LS.add a' b')
>    | _ -> failwith "incompatible"
> 
>    let rec to_string = function
>       P i -> string_of_int i
>     | L l -> List.fold_left (fun r x -> r^" "^(to_string x)) "" l
>  end
> and LS : sig type t = M.t list val add : t -> t -> t end = LL(M)
> 
> open M
> let p = L [P 1; P 2]
> let q = add p p
> let () =
>  print_endline (to_string p);
>  print_endline (to_string q)


Strangely, OCaml version 3.08.0 can handle this code.
So, the developer team must know the reason.
Did you write a bug report ?

Keiko NAKATA