Summary:
This article discusses the semantics of relaxed atomics in C/C++ and highlights the bugs in current compiler implementations. The author proposes the implementation of Hans Boehm’s branch-after-load proposal as a fix for these bugs. Using the Téléchat compiler testing tool, the author found thousands of bug instances in compiled code. They suggest implementing the proposed fix behind a command-line flag, allowing users to choose between performance and correctness guarantees. The branch-after-load proposal has proven to be sound and has a reasonable performance trade-off. The author intends to test the implementation using Téléchat.
https://lukegeeson.com/blog/2023-10-17-A-Proposal-For-Relaxed-Atomics/