On Sat, 23 Nov 2024, Maciej W. Rozycki wrote: > I found no previous bug report, so this is now PR target/117759[1]. An > obvious bug fix has been posted for review as well[2].
I gave this issue some thought as I travelled across Europe over the weekend and I have now withdrawn the proposed fix for the PR. The full `-msafe-bwa' feature is required for a fix, as the data race comes from *outside* rather than from any lack of atomicity of the store to the object itself. As the previous value of the object itself is discarded, a plain RMW sequence is already atomic, because the RM part only applies to data outside the object accessed. However a similar RMW sequence made to update data located within the same longword *outside* the atomic object concerned will clobber it. I've posted more details in the PR. Maciej