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: "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, 29 Jan 2015 01:04:33 +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
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Smith from comment #2)
> libstdc++ uses these builtins in bits/atomic_base.h:
>
> __pointer_type
> fetch_add(ptrdiff_t __d,
> memory_order __m = memory_order_seq_cst) noexcept
> { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); }
Ah yes, the _M_type_size function was added to fix PR 51811 so that
std::atomic<T*> would work correctly.