public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104480] [12 Regression] Combining stores across memory locations might violate [intro.memory]/3
Date: Thu, 10 Feb 2022 10:51:02 +0000	[thread overview]
Message-ID: <bug-104480-4-m5fiFa9pOy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104480-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104480

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> Nothing in your code imposes an ordering on those stores. Another thread
> cannot observe it, because you are using non-atomic operations.

To be more precise, another thread cannot even observe *one* of those stores
without a data race. It certainly can't observe both and conclude they happened
out of order.

To avoid a data race the other thread must ensure that the entire call to f
happens-before any read of either memory location. And if the entire call
happens-before the read, you can't see which order the stores happened in.

  parent reply	other threads:[~2022-02-10 10:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  8:13 [Bug c++/104480] New: [trunk] " marc.mutz at hotmail dot com
2022-02-10  8:25 ` [Bug tree-optimization/104480] [12 Regression] " pinskia at gcc dot gnu.org
2022-02-10  8:40 ` rguenth at gcc dot gnu.org
2022-02-10  8:49 ` pinskia at gcc dot gnu.org
2022-02-10 10:48 ` redi at gcc dot gnu.org
2022-02-10 10:51 ` redi at gcc dot gnu.org [this message]
2022-02-10 11:54 ` marc.mutz at hotmail dot com

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=bug-104480-4-m5fiFa9pOy@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).