This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52190] question about atomic intrinsics -- test and documentation vary -- please clarify
- From: "amacleod at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 09 Feb 2012 20:40:05 +0000
- Subject: [Bug c/52190] question about atomic intrinsics -- test and documentation vary -- please clarify
- Auto-submitted: auto-generated
- References: <bug-52190-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52190
Andrew Macleod <amacleod at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amacleod at redhat dot com
--- Comment #1 from Andrew Macleod <amacleod at redhat dot com> 2012-02-09 20:40:05 UTC ---
Its a discrepancy due to vagueness :-)
The extra parameter is for an optional pointer to the object to allow the
alignment to be examined.
The standard was unclear about alignment issues, and when the atomics were
being designed and implemented, it was still unclear what direction things were
going.
The routines were designed so that an aligned object could be lock free and an
unaligned object may be locked. The last set of discussions I had indicate
that it is undesirable for 2 objects of the same size not to both be lock-free
or locked. (ie, all objects of a given size must be the same). We'll
finalize it all in gcc 4.8, but I think going forward we are probably only
going to support aligned atomic operations...
Anyway, thats why the extra parameter is there. a 0 passed in instead of a
pointer means "use standard alignment for an object of this size".
I will change the documentation to match reality.
Andrew