[Bug rtl-optimization/105453] [9/10/11 Regression] load introduced by ce1 for conditional loads at -O1, might cause issues with the C/C++ memory model

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 3 07:24:14 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105453

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> There is no issue here as there is no atomic barrier as required by the c11
> and c++11 standards in their memory model

I agree that GCC's output is allowed by the memory model. If another thread is
changing either of those globals then func_1 needs to be synchronised with it
to avoid data races, i.e. it would have undefined behaviour anyway, whatever
code GCC generated.


More information about the Gcc-bugs mailing list