atomic_thread_fence sets the synchronization order of the memory of non-atomic and relaxed atomic accesses.
Concurrency, especially the relaxed concurrency memory, is a well-known thin and error-prone domain, and thus checking for such optimizations is of great interest. Ref1 .
CompCertTSO is widely used for such a thing.
CompCertTSO is a compiler that generates x86 assembly code from ClightTSO, a large subset of the C programming language extended with concurrency primitives for flow control and synchronization, and with a TSO attenuated memory model based on the x86-TSO model.
Thus, for verification, optimization, and testing, it is desirable that this function has a "C" relationship.
source share