From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 EDC89BB84 for ; Wed, 19 Apr 2006 00:16:48 +0200 (CEST) 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 k3IMGm4r024677 for ; Wed, 19 Apr 2006 00:16:48 +0200 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 AAA23396 for ; Wed, 19 Apr 2006 00:16:48 +0200 (MET DST) Received: from smtp4-g19.free.fr (smtp4-g19.free.fr [212.27.42.30]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3IMGlJ3024669 for ; Wed, 19 Apr 2006 00:16:47 +0200 Received: from [192.168.0.3] (ron59-1-82-225-126-56.fbx.proxad.net [82.225.126.56]) by smtp4-g19.free.fr (Postfix) with ESMTP id 5BEA05479C for ; Wed, 19 Apr 2006 00:16:47 +0200 (CEST) Message-ID: <4445734B.6030004@free.fr> Date: Wed, 19 Apr 2006 01:16:27 +0200 From: Marc Lasson User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Bug in ocamlc or in ocamlrun. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44456550.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4445654F.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bug:01 ocamlc:01 ocamlrun:01 ocamlc:01 bug:01 ocaml:01 sig:01 val:01 struct:01 rec:01 sig:01 val:01 struct:01 failwith:01 rec:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hello, 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) ---------------------- If i replace the function LL.add by let rec add a b = match a, b with [], [] -> [] | x::a', y::b' -> (R.add x y)::(add a' b') | _ -> failwith "add" the segmentation fault magically disappear. Hope that helps, -- Marc Lasson.