On Mon, 25 Nov 2024, Maciej W. Rozycki wrote:

> 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.

Note this is why the C++ memory model constrains what "outside" parts
of a memory location may be accessed by such a RMW sequence to
avoid producing data-races for data that isn't accessed by the program.

I don't think you can reliably fix this without enforcing atomic
sequences on every access that isn't constrained to memory within itself.

Richard.

>  I've posted more details in the PR.



>   Maciej
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to