diff options
author | Martin Sebor <msebor@redhat.com> | 2015-12-17 01:33:41 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2015-12-16 18:33:41 -0700 |
commit | 7585d94ffefc0c1c80d5cb191b461fb18e124553 (patch) | |
tree | 6096f84130edc1cfc3d88b7e2927b49a222da8da /gcc/ginclude | |
parent | 9393bc31a2a33c7662fe9d11afb059da3b46c2a6 (diff) | |
download | gcc-7585d94ffefc0c1c80d5cb191b461fb18e124553.zip gcc-7585d94ffefc0c1c80d5cb191b461fb18e124553.tar.gz gcc-7585d94ffefc0c1c80d5cb191b461fb18e124553.tar.bz2 |
PR c/68868 - atomic_init emits an unnecessary fence
gcc/ChangeLog
* ginclude/stdatomic.h (atomic_init): Use atomic_store instead
of plain assignment.
gcc/testsuite/ChangeLog
* testsuite/gcc.dg/atomic/stdatomic-init.c: New test.
From-SVN: r231733
Diffstat (limited to 'gcc/ginclude')
-rw-r--r-- | gcc/ginclude/stdatomic.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/ginclude/stdatomic.h b/gcc/ginclude/stdatomic.h index eb3b4d6..d77b569 100644 --- a/gcc/ginclude/stdatomic.h +++ b/gcc/ginclude/stdatomic.h @@ -77,12 +77,10 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; #define ATOMIC_VAR_INIT(VALUE) (VALUE) -#define atomic_init(PTR, VAL) \ - do \ - { \ - *(PTR) = (VAL); \ - } \ - while (0) + +/* Initialize an atomic object pointed to by PTR with VAL. */ +#define atomic_init(PTR, VAL) \ + atomic_store_explicit (PTR, VAL, __ATOMIC_RELAXED) #define kill_dependency(Y) \ __extension__ \ |