From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 86C3F7F75C for ; Sun, 7 Sep 2014 20:47:44 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=80.12.242.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=80.12.242.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.smtpout.orange.fr) identity=helo; client-ip=80.12.242.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@smtp.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlIBALOnDFRQDPKDm2dsb2JhbABZhzPOPQGBGxABAQEBAQYLCwkUKoQEAQUjFUABEAsYAgIFFgsCAgkDAgECAUUGAQwBBwEBiEKmVpR/AReBLI4hB4J5gVMBBJxyh0GRToM5AQEB X-IPAS-Result: AlIBALOnDFRQDPKDm2dsb2JhbABZhzPOPQGBGxABAQEBAQYLCwkUKoQEAQUjFUABEAsYAgIFFgsCAgkDAgECAUUGAQwBBwEBiEKmVpR/AReBLI4hB4J5gVMBBJxyh0GRToM5AQEB X-IronPort-AV: E=Sophos;i="5.04,483,1406584800"; d="scan'208";a="93405276" Received: from smtp09.smtpout.orange.fr (HELO smtp.smtpout.orange.fr) ([80.12.242.131]) by mail2-smtp-roc.national.inria.fr with ESMTP; 07 Sep 2014 20:47:42 +0200 Received: from [192.168.1.60] ([82.120.183.224]) by mwinf5d44 with ME id oJnh1o00D4quFdu03JniMd; Sun, 07 Sep 2014 20:47:42 +0200 X-ME-Helo: [192.168.1.60] X-ME-Auth: ZnJpc2NoLmFsYWluQHdhbmFkb28uZnI= X-ME-Date: Sun, 07 Sep 2014 20:47:42 +0200 X-ME-IP: 82.120.183.224 Message-ID: <540CA84F.8090708@frisch.fr> Date: Sun, 07 Sep 2014 20:47:43 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Martin Jambon , Jeremy Yallop CC: Caml List References: <20140905215626.GB3416@annexia.org> <20140905221302.GE3099@annexia.org> <20140905221813.GC3416@annexia.org> <540A3B85.6010609@ens-lyon.org> <540AA0DB.1040202@ens-lyon.org> In-Reply-To: <540AA0DB.1040202@ens-lyon.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] segfault in simple program with 4.02 native On 9/6/2014 7:51 AM, Martin Jambon wrote: > Thanks for the explanation, Jeremy. I guess atdgen will have to use > "option refs" after all unless someone has a better idea. I might be missing some context, but the current code seems to playing two different tricks with the type system: using (Obj.magic 0.) as a dummy initial default value (to avoid references) and mutating normally immutable fields with Obj.set_field. Is that right? You might be able to keep the first trick, but storing the values in local references instead of field of the the target record (if those references don't espace from the function, they will be represented as local mutable variables, whose mutation might actually be more efficient than those of the record fields), building the target record at the end by reading from those references. -- Alain