This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
Michael Matz wrote:
Yes, and of course GCC doesn't move stores or loads over functions calls.
That's not the issue at all. The issue is, that people want to write
this:
if (condition)
*p = value;
(i.e. without any synchronization primitive or in fact anything else after
the store in the control region) and expect that the store indeed only
happens in that control region. And this expectation is misguided.
If this is correct (condition makes no function calls and no volatiles
are used, then I understand and agree.
Cheers,
mark
--
Mark Mielke <mark@mielke.cc>