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 8C3B57FD1E for ; Wed, 4 Nov 2015 16:57:02 +0100 (CET) IronPort-PHdr: 9a23:BySg2RDr5UyxbnOhk0EqUyQJP3N1i/DPJgcQr6AfoPdwSP/4ocbcNUDSrc9gkEXOFd2CrakU1qyN6+u/CSQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTqkbvqsMKDKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46Fp34d6XK77Z6U1S6BDRHRjajhtpZ6jiR6WBzGO7XsVSGlerVxtRUDn6xf3Rd255jH7vepV0S+cMN33RPYzQzv0q+9EQRXyiSoDfwUy8GzNh9Y42K1Sqgigqhg52IXUbZuYLtJxe6rceZURQm8XDehLUCkUOoKxdZECR8EBNONSppPh7w8WrBakHwTqD+PmzzVBnGPe2qYz1uA5CwaA1wslSYFd+E/Ipcn4Yf9BGdu+y7PFmHCaN6tb Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=pierre.chambart@ocamlpro.com; spf=None smtp.mailfrom=pierre.chambart@ocamlpro.com; spf=Pass smtp.helo=postmaster@redisdead.crans.org Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of pierre.chambart@ocamlpro.com) identity=pra; client-ip=138.231.136.39; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierre.chambart@ocamlpro.com"; x-sender="pierre.chambart@ocamlpro.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of pierre.chambart@ocamlpro.com) identity=mailfrom; client-ip=138.231.136.39; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierre.chambart@ocamlpro.com"; x-sender="pierre.chambart@ocamlpro.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@redisdead.crans.org designates 138.231.136.39 as permitted sender) identity=helo; client-ip=138.231.136.39; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierre.chambart@ocamlpro.com"; x-sender="postmaster@redisdead.crans.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CvAABqKjpWlyeI54pexB2DPoJVAoE/PBABAQEBAQEBARABAQEBAQgWB0+CLoIIAQEEJ1EBEAsYCRYPCQMCAQIBRQYBDAEHAogqA8IgAQEBAQEFAQEBAQEBARyGVYR+iTgBBJZIjn2HQYpTiFM4glKBXYYmAQEB X-IPAS-Result: A0CvAABqKjpWlyeI54pexB2DPoJVAoE/PBABAQEBAQEBARABAQEBAQgWB0+CLoIIAQEEJ1EBEAsYCRYPCQMCAQIBRQYBDAEHAogqA8IgAQEBAQEFAQEBAQEBARyGVYR+iTgBBJZIjn2HQYpTiFM4glKBXYYmAQEB X-IronPort-AV: E=Sophos;i="5.20,243,1444687200"; d="scan'208";a="186060422" Received: from redisdead.crans.org ([138.231.136.39]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 04 Nov 2015 16:56:50 +0100 Received: from [172.25.224.219] (unknown [38.105.200.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by redisdead.crans.org (Postfix) with ESMTPSA id 784BF7AF; Wed, 4 Nov 2015 16:56:49 +0100 (CET) Message-ID: <563A2ABF.9040506@ocamlpro.com> Date: Wed, 04 Nov 2015 15:56:47 +0000 From: Pierre Chambart Organization: OcamlPro User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: "Richard W.M. Jones" , Gabriel Scherer CC: caml users References: <20151104124321.GA25230@annexia.org> <20151104152339.GP3006@annexia.org> In-Reply-To: <20151104152339.GP3006@annexia.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Validation-by: pierre.chambart@ocamlpro.com Subject: Re: [Caml-list] Are refs volatile? On 04/11/2015 15:23, Richard W.M. Jones wrote: > On Wed, Nov 04, 2015 at 04:08:48PM +0100, Gabriel Scherer wrote: >> I find the question hard to understand, so I may have missed a subtlety in >> the code you have shown. > It's very possible I don't know what I'm talking about, but > this is my analysis: > >>> List.iter ( >>> fun task -> >>> if not !quit then task (); >>> ) tasks; > Suppose that the optimizer can see the contents of `task', and see > that it cannot update the quit variable. In that case, could it > assume that quit is a constant, and hoist the test outside the loop? > ie. transforming the code to: > > if not !quit then ( > List.iter ( > fun task -> > task (); > ) tasks > ) > > Rich. > No. There is no specified semantic of ocaml, but in any reasonable semantics of it won't be allowed. I won't write something that could do that, and I would consider it a bug if it happened. -- Pierre Chambart