mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Bartosz Brachaczek <b.brachaczek@gmail.com>
Subject: Re: Documentation of memcpy and undefined behavior in memset
Date: Thu, 6 Jul 2017 21:28:32 +0200	[thread overview]
Message-ID: <20170706192831.GC10974@port70.net> (raw)
In-Reply-To: <8760f5s7o8.fsf@gmail.com>

* Leah Neukirchen <leah@vuxu.org> [2017-07-06 21:10:31 +0200]:
> Bartosz Brachaczek <b.brachaczek@gmail.com> writes:
> 
> > On 7/6/2017 6:23 PM, Rich Felker wrote:
> >> I think you're correct, at least under a pessimistic interpretation of
> >> the standard. I can't find where they actually define "modifies", and
> >> you could argue that assignment of the same value twice "modifies" the
> >> object at most once, but I don't like relying on that kind of
> >> ambiguity and it's easy enough to fix just by adding a sequence point.
> >
> > I don't have a copy of C11, but N1570 reads in a note to 3.1:
> >
> >> ‘‘Modify’’ includes the case where the new value being stored is the
> >> same as the previous value.
> 
> C11 also specifies a sequence for assignment (6.5.16.3):
> 
> > The side effect of updating the stored value of the left operand is
> > sequenced after the value computations of the left and right
> > operands.

yes, unfortunately the value computation of the right
operand can be unsequenced wrt the side effect of the
right operand..

but since expression evaluation with side effects is
not specified in great detail it's hard to tell.


  reply	other threads:[~2017-07-06 19:28 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
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 [this message]
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=20170706192831.GC10974@port70.net \
    --to=nsz@port70.net \
    --cc=b.brachaczek@gmail.com \
    --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).