From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p7GG15Tt023858 for ; Tue, 16 Aug 2011 18:01:05 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQCAO2TSk7RVdy2mGdsb2JhbABBmHI1jwgIFAEBAQEBCAkNBxQlgUABAQEBAxICLAEbEgsBAwwGBQsaISMRAQUBChIZEhCHUptTCow3glWFPDuIbQIDBoVjXwSTEoY0hiU8g3w X-IronPort-AV: E=Sophos;i="4.67,381,1309730400"; d="sig'?scan'208";a="105603648" Received: from mail-vx0-f182.google.com ([209.85.220.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 16 Aug 2011 18:00:51 +0200 Received: by vxh11 with SMTP id 11so68165vxh.27 for ; Tue, 16 Aug 2011 09:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-pgp-agent :x-mailer; bh=S1m1cxdGaYCLB1LPMXY2Y0CpVQPiQcuEjvKv7792pxU=; b=RTvsapWnqPNDYVn7M5dkq6U7NSJfdjmf40TOeJuyVxzay9nXwPvhANDGlTr5PX0mSF 7kwZpIXm9im39c44ZTwU40vEAJjR/3zOxhUcSMyjbR9K9BzieVURO38AUUipH52h25qJ 555DfCuDB9QjHNIsCRzfkfWtxjj3fZrwfDiAQ= Received: by 10.52.95.37 with SMTP id dh5mr4978000vdb.344.1313510450489; Tue, 16 Aug 2011 09:00:50 -0700 (PDT) Received: from dhcp-129-105-65-159.astro.northwestern.edu (dhcp-129-105-65-159.astro.northwestern.edu [129.105.65.159]) by mx.google.com with ESMTPS id h4sm111816vcx.21.2011.08.16.09.00.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Aug 2011 09:00:49 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-3-195799426" From: "Will M. Farr" In-Reply-To: <20110816155137.GA18365@ccellier.rd.securactive.lan> Date: Tue, 16 Aug 2011 12:00:48 -0400 Cc: Caml List Content-Transfer-Encoding: 7bit Message-Id: <7B4FF424-3D42-42AD-BA54-D099ABB25713@gmail.com> References: <20110816152550.GA21081@annexia.org> <20110816155137.GA18365@ccellier.rd.securactive.lan> To: rixed@happyleptic.org X-Pgp-Agent: GPGMail 1.3.3 X-Mailer: Apple Mail (2.1084) Subject: Re: [Caml-list] Interfacing with C: bad practice This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-3-195799426 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Yes. The C compiler can see that the address of list has been passed to ex= ternal functions in CAMLlocal, so has to assume the worst: that the address= is stored in some global variable, and caml_copy_string or the functions i= t calls can access it and thereby change the value of list. If the compile= r is a spectacularly optimizing one (i.e. performs a ton of inter-module pr= ocedure inlining and/or very careful escape analysis), it *may* be able to = prove that this never happens, and therefore would be allowed to optimize t= he call in the manner proposed. In this case, of course, "the worst" actua= lly happens, so such a proof must fail; if the proof does not fail, the com= piler has a bug. Will On Aug 16, 2011, at 11:51 AM, rixed@happyleptic.org wrote: > -[ Tue, Aug 16, 2011 at 04:25:50PM +0100, Richard W.M. Jones ]---- >> I think this must be a bug in your C compiler. The address of list is >> stashed in the roots struct, so the C compiler should know that list >> can be changed by the call to caml_copy_string. >=20 > Are you certain that the C abstract machine allow for any value stored > within the frameset of a function to be changed by a function call when > the address of the variable at hand is not passed to this function? And > mandate the C compiler to handle this scenario? In other words, mandate > the C compiler to reload from the stack all values between any function > call? >=20 > I don't think so ; or more likely I have not understood your view on > this matter? >=20 >=20 > --=20 > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 --Apple-Mail-3-195799426 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAk5KlDAACgkQ1IoZbWY+dGwORACdHS+Wx0xP3AVmwQ1PlzEihggD Ug0AoN4FPce3pi6iZ1ARA6o8ju7mTNhV =i4fP -----END PGP SIGNATURE----- --Apple-Mail-3-195799426--