From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id BC647BC0A for ; Thu, 5 Apr 2007 11:33:09 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.231]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l359X8du000587 for ; Thu, 5 Apr 2007 11:33:09 +0200 Received: by wr-out-0506.google.com with SMTP id 69so335582wra for ; Thu, 05 Apr 2007 02:33:08 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VxSDImu29seCI4KArVnBjFciGfRYATxesSJsA8qNg94gEdIof7+dtA6KGoO/i0Q0FPhW1M0Lef12nRH0ysW7UGkwtDwDENTmavz67dJiQNI+bQfQ77l/4X0o+jpTuJfkF3CjDwJDrZ+Z6rVA/zRdPrdPAa4DmgsLqRQSHCGFidE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gan411gHuUIQp/sl87yBATqjX3qugD7iOkfnoYC2HUSHD/OZK02uJEHFkk3Acjhb31RyqA4nTqdCfoR7XSY957D4FBwlN9wlNm6qf0kKMOBIAbpYZXUHNYHSPJJmf7X4Z+mf7dt7OedFbn6UztEXPyN2LuCBbFrXHGl33pvvvkA= Received: by 10.115.108.1 with SMTP id k1mr649153wam.1175765587767; Thu, 05 Apr 2007 02:33:07 -0700 (PDT) Received: by 10.114.66.7 with HTTP; Thu, 5 Apr 2007 02:33:07 -0700 (PDT) Message-ID: Date: Thu, 5 Apr 2007 11:33:07 +0200 From: "Roland Zumkeller" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Polymorphic recursion In-Reply-To: <4614037E.6060709@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6f9f8f4a0704030959l8ebb155g8532e3ee6d31c66d@mail.gmail.com> <4613C0AA.8010405@inria.fr> <4613C22E.5060206@inria.fr> <4614037E.6060709@inria.fr> X-j-chkmail-Score: MSGID : 4614C254.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4614C254.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursion:01 frisch:01 frisch:01 well-typed:01 coq:01 ocaml:01 type-checker:01 translating:01 coq:01 lambda:01 endline:01 ocamlopt:01 segfault:01 ocamlc:01 bug:01 On 04/04/07, Alain Frisch wrote: > The fact that something is well-typed in Coq does not mean that you can > just translate it to OCaml by adding a few Obj.magic to make the > type-checker happy. As I understand Pierre Letouzey's PhD thesis explains how this can be done. Your example couldn't result from translating a Coq term, since "String.copy", "ref", and "Gc.major" are not part of its formalism (a flavour of lambda calculus with inductive types). > let () = > let x = if ("a" = "b") then Obj.magic 0 else String.copy "abc" in > for i = 0 to 100000 do ignore (ref [1]) done; > Gc.major (); > print_endline x > This code compiled with ocamlopt produces a segfault on my machine. On my machine it prints "$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d" and when compiled with ocamlc "abc". Is this a bug? Roland -- http://www.lix.polytechnique.fr/~zumkeller/