On Mon, Jan 06, 2025 at 05:12:57PM -0700, Jeff Law wrote: > > > On 1/6/25 6:03 AM, Maciej W. Rozycki wrote: > > With non-BWX Alpha implementations we have a problem of data races where > > a 8-bit byte or 16-bit word quantity is to be written to memory in that > > in those cases we use an unprotected RMW access of a 32-bit longword or > > 64-bit quadword width. If contents of the longword or quadword accessed > > outside the byte or word to be written are changed midway through by a > > concurrent write executing on the same CPU such as by a signal handler > > or a parallel write executing on another CPU such as by another thread > > or via a shared memory segment, then the concluding write of the RMW > > access will clobber them. This is especially important for the safety > > of RCU algorithms, but is otherwise an issue anyway. > But in the case of concurrent accesses, shouldn't these objects be declared > as atomic? Similarly for objects potentially accessed in a signal hnadler > shouldn't they be accessed via sig_atomic_t? > > Point being I'm not 100% sure we really need to tackle this problem in a > fully generic manner for all 8/16 bit accesses > > What am I missing here?
Doesn't the behavior Maciej is describing constitute a data race injected by the compiler? As of C11 and C++11, this is forbidden, correct? Thanx, Paul