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

Peter Dimov <pdimov at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pdimov at gmail dot com

--- Comment #7 from Peter Dimov <pdimov at gmail dot com> ---
The spinlock is indeed using an `unsigned char`:

https://github.com/boostorg/smart_ptr/blob/c577d68b0272fd0bddc88ea60a8db07219391589/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp#L33

That's because `__atomic_test_and_set` is documented to work on either `bool`
or `char`:

https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/built-in-functions-for-memory-model-aware-atomic-operations.html#_CPPv421__atomic_test_and_setPvi

"bool __atomic_test_and_set(void *ptr, int memorder)

This built-in function performs an atomic test-and-set operation on the byte at
*ptr. The byte is set to some implementation defined nonzero ‘set’ value and
the return value is true if and only if the previous contents were ‘set’. It
should be only used for operands of type bool or char. For other types only
part of the value may be set."

I don't see an alignment requirement being mentioned here.

Reply via email to