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

--- Comment #6 from Richard Henderson <rth at gcc dot gnu.org> ---
(In reply to Bin Fan from comment #5)
> So after the fix, atomic_is_lock_free will always return 0 for
> size=3,align=1 atomic struct objects?

Yes.

> I understand currently libatomic tries to make an atomic object lock-free if
> its memory location fit in a certain sized window. So for atomic operations
> such as atomic_store where the actual address is passed in, the operation
> can be still either lock-free or locked, right?

Yes.

> I'm wondering if it's standard conforming since the lock-free property
> is still per-object, or it can be seen as an optimization, i.e. 
> atomic_is_lock_free query for the
> object returns 0, but atomic operations on the object could be lock-free.

My understanding is that it's valid to optimize the operation to lock-free,
but since there may exist objects for which we will have to use the lock,
the atomic_is_lock_free query must return false.

Reply via email to