Optimization of conditional access to globals: thread-unsafe?
Mark Mielke
mark@mark.mielke.cc
Mon Oct 29 15:16:00 GMT 2007
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>
More information about the Gcc
mailing list