public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "torvald at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65697] __atomic memory barriers not strong enough for __sync builtins
Date: Wed, 15 Apr 2015 15:49:00 -0000	[thread overview]
Message-ID: <bug-65697-4-5NDQMXw7fQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65697-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #21 from torvald at gcc dot gnu.org ---
(In reply to Andrew Haley from comment #20)
> (In reply to mwahab from comment #19)
> > (In reply to Andrew Haley from comment #18)
> > 
> > It looks inconsistent with C11 S7.17.7.4-2 (C++11 S29.6.4-21) "Further, if
> > the comparison is true, memory is affected according to the value of
> > success, and if the comparison is false, memory is affected according to the
> > value of failure." (where success and failure are the memory model
> > arguments.) In this case, the write to *exp should be memory_order_seq_cst.
> 
> But no store actually takes place, so the only effect is that of the read.
> You can't have a sequentially consistent store without a store.

I agree. If you continue reading in the C++11 paragraph that you cited, you'll
see that if just one MO is provided and the CAS fails, an acq_rel MO is
downgraded to acquire and a release MO to relaxed.  This is consistent with no
update of the atomic variable (note that expected is not atomic, so applying an
MO to accesses to it is not meaningful in any case).  However, if the provided
MO is seq_cst, I think a failed CAS still needs to be equivalent to a seq_cst
load.


  parent reply	other threads:[~2015-04-15 15:49 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 11:25 [Bug target/65697] New: " matthew.wahab at arm dot com
2015-04-08 11:33 ` [Bug target/65697] " matthew.wahab at arm dot com
2015-04-08 16:16 ` jakub at gcc dot gnu.org
2015-04-09  9:53 ` matthew.wahab at arm dot com
2015-04-09 10:08 ` torvald at gcc dot gnu.org
2015-04-09 10:11 ` torvald at gcc dot gnu.org
2015-04-09 10:47 ` matthew.wahab at arm dot com
2015-04-09 11:10 ` redi at gcc dot gnu.org
2015-04-09 11:25 ` matthew.wahab at arm dot com
2015-04-09 11:51 ` amacleod at redhat dot com
2015-04-09 14:03 ` matthew.wahab at arm dot com
2015-04-10 15:09 ` jgreenhalgh at gcc dot gnu.org
2015-04-15 10:16 ` aph at gcc dot gnu.org
2015-04-15 11:11 ` mwahab at gcc dot gnu.org
2015-04-15 11:54 ` jakub at gcc dot gnu.org
2015-04-15 12:43 ` aph at gcc dot gnu.org
2015-04-15 13:01 ` mwahab at gcc dot gnu.org
2015-04-15 14:10 ` aph at gcc dot gnu.org
2015-04-15 14:33 ` mwahab at gcc dot gnu.org
2015-04-15 14:49 ` aph at gcc dot gnu.org
2015-04-15 15:49 ` torvald at gcc dot gnu.org [this message]
2015-04-15 20:05 ` torvald at gcc dot gnu.org
2015-04-15 20:49 ` jgreenhalgh at gcc dot gnu.org
2015-04-15 22:13 ` torvald at gcc dot gnu.org
2015-04-16  3:45 ` amacleod at redhat dot com
2015-04-16  8:11 ` mwahab at gcc dot gnu.org
2015-04-16  8:50 ` mwahab at gcc dot gnu.org
2015-04-16  9:01 ` jgreenhalgh at gcc dot gnu.org
2015-04-16  9:18 ` mwahab at gcc dot gnu.org
2015-04-16 11:37 ` amacleod at redhat dot com
2015-04-16 11:54 ` torvald at gcc dot gnu.org
2015-04-16 12:13 ` mwahab at gcc dot gnu.org
2015-04-16 13:27 ` jgreenhalgh at gcc dot gnu.org
2015-04-17 15:38 ` torvald at gcc dot gnu.org
2015-04-17 15:48 ` torvald at gcc dot gnu.org
2015-04-17 18:00 ` amacleod at redhat dot com
2015-04-20 13:42 ` mwahab at gcc dot gnu.org
2015-04-20 15:17 ` mwahab at gcc dot gnu.org
2015-04-21 18:51 ` rth at gcc dot gnu.org
2015-04-28 15:32 ` jgreenhalgh at gcc dot gnu.org
2015-04-29  8:47 ` mwahab at gcc dot gnu.org
2015-04-29 12:20 ` jgreenhalgh at gcc dot gnu.org
2015-04-29 13:26 ` mwahab at gcc dot gnu.org
2015-04-29 16:04 ` amacleod at redhat dot com
2015-04-30  8:20 ` mwahab at gcc dot gnu.org
2015-05-01 12:53 ` torvald at gcc dot gnu.org
2015-05-06 14:25 ` amacleod at redhat dot com
2015-05-06 15:58 ` mwahab at gcc dot gnu.org
2015-05-07 13:25 ` mwahab at gcc dot gnu.org
2015-05-08  8:01 ` mwahab at gcc dot gnu.org
2015-05-11 13:44 ` jgreenhalgh at gcc dot gnu.org
2015-05-11 15:58 ` mwahab at gcc dot gnu.org
2015-05-12 20:02 ` amacleod at redhat dot com
2015-06-01 15:19 ` mwahab at gcc dot gnu.org
2015-06-01 15:21 ` mwahab at gcc dot gnu.org
2015-06-01 15:25 ` mwahab at gcc dot gnu.org
2015-06-11  7:35 ` ramana at gcc dot gnu.org
2015-06-29 16:04 ` mwahab at gcc dot gnu.org
2015-06-29 16:09 ` mwahab at gcc dot gnu.org
2015-06-29 16:12 ` mwahab at gcc dot gnu.org
2015-08-05 11:21 ` mwahab at gcc dot gnu.org
2015-08-05 11:30 ` mwahab at gcc dot gnu.org
2015-08-05 11:41 ` mwahab at gcc dot gnu.org
2015-08-05 11:49 ` mwahab at gcc dot gnu.org
2015-08-05 13:28 ` mwahab at gcc dot gnu.org
2015-08-05 13:40 ` mwahab at gcc dot gnu.org
2015-08-05 13:43 ` mwahab at gcc dot gnu.org
2015-09-30  3:07 ` ramana at gcc dot gnu.org
2015-10-05  8:08 ` mwahab at gcc dot gnu.org
2015-10-05  8:30 ` ramana at gcc dot gnu.org

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-65697-4-5NDQMXw7fQ@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).