mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: Documentation of memcpy and undefined behavior in memset
Date: Thu, 6 Jul 2017 20:52:18 +0200	[thread overview]
Message-ID: <20170706205218.6b3b03a2@inria.fr> (raw)
In-Reply-To: <20170706181326.GF1627@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]

Hello,

On Thu, 6 Jul 2017 14:13:26 -0400 Rich Felker <dalias@libc.org> wrote:

> On Thu, Jul 06, 2017 at 08:38:29PM +0300, Alexander Monakov wrote:
> > On Thu, 6 Jul 2017, Rich Felker wrote:
> >   
> > > I'm doubtful of this. Certainly passing a pointer to memcpy with a
> > > nonzero n is a guarantee that the pointed-to object is
> > > non-volatile. The n=0 case is less clear though.  
> > 
> > My view is that since in n=0 case no memory access inside of memcpy
> > takes place, the compiler may not deduce that the pointed-to object
> > is ok for speculative reads.  
> 
> Indeed, I think that's a valid interpretation, but not the only one;
> the problem here is that the specification is ambiguous, and I suspect
> nobody wants to fix the ambiguity because they know they're going to
> have an argument over what it was intended to mean...

No, no, not because of that :)

More seriously, if there is existing practice in both ways, the
committee would not want to invalidate any of them for just a TC. In
consequence, as a user of such functions you'd always have to be
conservative. As an implementor, you can basically chose, but this
doesn't help much because your users can't rely on that particular
behavior.

Now when it comes to changes for a new standard, people would certainly
be more open-minded. So if anybody thinks they want to make a proposal
for C2x, don't hesitate.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2017-07-06 18:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 14:15 Pascal Cuoq
2017-07-06 15:52 ` Alexander Monakov
2017-07-06 16:23 ` Rich Felker
2017-07-06 17:02   ` Alexander Monakov
2017-07-06 17:11     ` Rich Felker
2017-07-06 17:17       ` Alexander Monakov
2017-07-06 17:22         ` Rich Felker
2017-07-06 17:38           ` Alexander Monakov
2017-07-06 18:13             ` Rich Felker
2017-07-06 18:52               ` Jens Gustedt [this message]
2017-07-06 19:23                 ` Szabolcs Nagy
2017-07-06 23:52                   ` Jens Gustedt
2017-07-06 19:05   ` Bartosz Brachaczek
2017-07-06 19:10     ` Leah Neukirchen
2017-07-06 19:28       ` Szabolcs Nagy
2017-07-06 16:29 ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170706205218.6b3b03a2@inria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).