This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Jan 2015 20:38:11 +0000
- Subject: [Bug c/64843] miscompilation of atomic_fetch_add on atomic pointer type
- Auto-submitted: auto-generated
- References: <bug-64843-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64843
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |documentation, wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-01-28
Ever confirmed|0 |1
Known to fail| |5.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The documentation indeed suggests this:
"These built-in functions perform the operation suggested by the name, and
return the value that had previously been in @code{*@var{ptr}}. That is,
@smallexample
@{ tmp = *ptr; *ptr @var{op}= val; return tmp; @}
@end smallexample"
thus here
*(&p) += 1;
Whether the bug is in documentation or code is another question. Confirmed
that the testcase produces cited assembly on x86_64 and some older trunk.