This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/65697] __atomic memory barriers not strong enough for __sync builtins
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 09 Apr 2015 11:10:07 +0000
- Subject: [Bug target/65697] __atomic memory barriers not strong enough for __sync builtins
- Auto-submitted: auto-generated
- References: <bug-65697-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65697
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Matthew Wahab from comment #7)
> I agree that this wouldn't affect valid C11 code (because of data-races) but
> my understanding is that __sync builtins don't require a C11 model. The
You say that like it's a good thing :-)
They don't require a memory model only because there wasn't a cross-platform
one that existed at the time.
> problem is that the __syncs are being implemented using atomic operations
> that do assume a C11 model and its notion of program validity. This looks
> like it would lead to differences in behaviour when code, using only the
> __sync builtins and knowing nothing of C11, is moved between targets with
> different memory models.
It seems unsurprising to me that you'll get different behaviour when trying to
use a program written with no formal memory model on platforms with different
memory models.