[Bug libstdc++/54005] Use __atomic_always_lock_free in libstdc++ is_lock_free instead of __atomic_is_lock_free

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 2 09:16:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54005

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hans-Peter Nilsson from comment #16)
> (In reply to Jonathan Wakely from comment #14)
> > Can we close this?
> 
> No.  IIUC, we're still/again using __atomic_is_lock_free with alignment
> deduced from the current object rather than the type (even though it's now a
> proxy-object; the faked pointer is constructed from the alignment of the
> current object).

It's constructed from __alignof(_M_i) and since r221945 that is given a fixed
alignment:

      static constexpr int _S_alignment =
        sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp);

      alignas(_S_alignment) __int_type _M_i;

So it will be the same for all objects of the type.

There was an additional fix in r227878 for Bug 65913.

> So, r221701 was wrong to change from null to the alignment-deduced
> fake-pointer.

I think the current code is right, and per-type.

I still want to close this.


More information about the Gcc-bugs mailing list