On Sun, 7 Nov 2021, 09:08 Martin Uecker wrote:

>
> It would be great if somebody could take a look at
> PR96159.
>
> It seems we do not do atomic accesses correctly
> when the alignment is insufficient for a lockfree
> access, but I think we should fall back to a
> library call in this case (as clang does).
>
> This is very unfortunate as it is an important
> functionality to be able to do atomic accesses
> on non-atomic types and it seems there is no way
> to achieve this.
>

C++ solves this with std::atomic_ref<T> which has a precondition that the
non-atomic object being operated on is suitably aligned. Working with
arbitrary objects is not supported, the user must ensure the alignment is
correct.

That seems like a reasonable restriction to me.

Reply via email to