This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/59785] atomic_store should load source operand atomically?
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Jan 2014 12:33:43 +0000
- Subject: [Bug c/59785] atomic_store should load source operand atomically?
- Auto-submitted: auto-generated
- References: <bug-59785-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59785
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is atomic store, not atomic load, what do you expect?
The only reason for taking val as a pointer rather than the value itself is
that some values really need to live in memory and the API is generic. If you
are trying to pass an address of a var that is modified by other threads, it is
just a bug in your source code, you likely want to do an atomic load into a
temporary automatic variable etc. which won't be modified by other threads and
only then atomic_store it.