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 5CF5A7EE88 for ; Mon, 9 May 2016 00:53:15 +0200 (CEST) IronPort-PHdr: 9a23:WhH/kBJP67vLbhUIVtmcpTZWNBhigK39O0sv0rFitYgVKvrxwZ3uMQTl6Ol3ixeRBMOAu6MC0rKd6v2/EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35Xxjrj5osCMKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46Fp34d6XK77Z6U1S6BDRHRjajhtpZ6jiR6WbwaU/nYGGkERjxtTSyHD4BzgRZr3+n/4u/Fl1TPcOcrrTKtyUDKu4r1wRRnAhyIONjp/+2bS3J9elqVe9T2orQZ+zoqcW4qVOeBzZOuJctoQX2tMWoBKXCxMGI6mR4QKBusFe+1fqt+u9BM1sRKiCFz0V6vUwThSiyqzhPVi3g== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f182.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.182 as permitted sender) identity=mailfrom; client-ip=209.85.223.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-io0-f182.google.com) identity=helo; client-ip=209.85.223.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-io0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DeAAAzwi9Xj7bfVdFehA19BqZDlEAkhTI6AoEVBzwQAQEBAQEBAQERAQEBAQcLCwkhL4ItghUBAQQSEQQZARsdAQMMBgULDQICJgICIQEBEQEFARwGEyKHcgEDEw6feoExPjGLO4FqgliGRQoZJw1Sg2sBAQEBAQEBAwEBAQEBARQBAQQKBW2FJIRMgkOEfIJZBZdxMYFVhCiGJoF5jxeHWIYlEh6BDjeCIx6BcSAyAQSJAQEBAQ X-IPAS-Result: A0DeAAAzwi9Xj7bfVdFehA19BqZDlEAkhTI6AoEVBzwQAQEBAQEBAQERAQEBAQcLCwkhL4ItghUBAQQSEQQZARsdAQMMBgULDQICJgICIQEBEQEFARwGEyKHcgEDEw6feoExPjGLO4FqgliGRQoZJw1Sg2sBAQEBAQEBAwEBAQEBARQBAQQKBW2FJIRMgkOEfIJZBZdxMYFVhCiGJoF5jxeHWIYlEh6BDjeCIx6BcSAyAQSJAQEBAQ X-IronPort-AV: E=Sophos;i="5.24,598,1454972400"; d="scan'208";a="217314715" Received: from mail-io0-f182.google.com ([209.85.223.182]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 09 May 2016 00:53:14 +0200 Received: by mail-io0-f182.google.com with SMTP id u185so183795256iod.3 for ; Sun, 08 May 2016 15:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HT1k7Kjhq8FQWg8HZqJyMpnrmtXjWNkwRpnmi50PtTs=; b=HvYNpX2Ih9rcAeQsCuCviyh3Zpj4ClSuWURkyC+1rmUr0wXGLkJAbdKugd2wA7e4XL 16GZJ6nYHXL+cMyk2eumdse9SGLxS/dTFS9LgASlf+y29r37Hn+vIFhDOGx5c9lm9Ubp 5LD0N0cGEgpVxCCpjTVgUMWDhcIOq0CUho+mtXn3C5m0Ox95sKBVzdEakf20M70vytQc 7Muypnhyzbk9kFkQRB0WrftiZMiYR0qVqtzB44gBMNryXrHRzoJGtNtB7BOWANle1OHR hH6h8XrsqFrrXRM4DbXtcuKnEAkFL9dl7b9RUAmbLzeel+Y0uybcO9NWUetgOva2krDo dIjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HT1k7Kjhq8FQWg8HZqJyMpnrmtXjWNkwRpnmi50PtTs=; b=VII4S5boAt6VdB83gVHqFPiPcLLJoiy9vLVeXOdu1wHJt/buBpPp98U19kpdBZnl98 a5+QdDWTlZCgTai5hw7/gKmCyarh7pdW/zu+01CWMyCMCBV9XQrSJATQnrc3gen+c59v C0M1QsdW5KmK5AD9Ugy4XEbL7VC0OUBFfT6s0JspIag3481Wz0OyDfLr5d9yyN3XH92/ l/hZEos6JXYEgjcBgNxZ4a2Luhshq3xAxgNe2er0vedOZlKL5T9Z6WKFbRj1q/Q8IHMS yNxPWSAVvFP3vmz1qzkGadIiADzHIjpZuz+0t+EGtddt/thsmkMw2C7jyFdCPTm0kjjz MvTg== X-Gm-Message-State: AOPr4FXMxgfKGb2APs6sAhBjkmtYCOiKktbioe8ZiIACHeYjR9PNq+d1PjW5PJB98+QtweSKmQS0AF5lWfX0Yw== X-Received: by 10.107.169.13 with SMTP id s13mr32558161ioe.19.1462747993208; Sun, 08 May 2016 15:53:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.89.195 with HTTP; Sun, 8 May 2016 15:52:33 -0700 (PDT) In-Reply-To: References: From: Gabriel Scherer Date: Sun, 8 May 2016 18:52:33 -0400 Message-ID: To: Jesper Louis Andersen Cc: Anthony Tavener , "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Occasional malformed strings; OCaml -> OpenGL, via tgls/ctypes. On Sun, May 8, 2016 at 5:04 PM, Jesper Louis Andersen wrote: > The problem there is too aggressive optimization on an ignore statement, > but if the OpenGL bindings, or flambda is to blame is a bit up in the air to me. If you look at the corresponding commit: https://github.com/LaurentMazare/tensorflow-ocaml/commit/111b4727cec992bab8bc67c22ccc8c31942ffbb2 It seems clear to me that the code was making un-portable assumptions on the fact that using (ignore l) in a closure would force l to remain live. It is not a bug of flambda if these kind of assumptions are broken. (On the other hand, the fact that flambda breaks a lot of the "probably too clever for its own good" code out there suggests that one should be careful when adopting it.) Note the nice trick to use the new 4.03 function opaque_identity in a way that still works on older OCaml versions: + (* [opaque_identity] is not available pre 4.03, this hack ensure that it + exists. *) + let opaque_identity x = x + let _ = opaque_identity + let opaque_identity = let open Sys in opaque_identity On older versions, this is just a rebinding, on newer version this uses "let open" shadowing. (I suspect that the warnings that try to detect involuntary shadowing may fire on this code, now or in the future. Speaking of code slightly too clever for its own good...) On Sun, May 8, 2016 at 5:04 PM, Jesper Louis Andersen wrote: > > On Sun, May 8, 2016 at 7:08 PM, Anthony Tavener > wrote: >> >> TL;DR: Constant string like "fontColor" can (rarely) come out like >> "\220\552\663\1" after foreign call to OpenGL. > > > It may be flambda-related, as the following problem looks much like it: > > https://github.com/LaurentMazare/tensorflow-ocaml/issues/7 > > I hit that last week with flambda. The problem there is too aggressive > optimization on an ignore statement, but if the OpenGL bindings, or flambda > is to blame is a bit up in the air to me. > > > -- > J.