Optimization of conditional access to globals: thread-unsafe?
Ian Lance Taylor
iant@google.com
Fri Oct 26 15:50:00 GMT 2007
Tomash Brechko <tomash.brechko@gmail.com> writes:
> - the compiler should not introduce speculative stores to the shared
> objects. This is what my original question was about. I haven't
> read all the papers yet, so one thing is still unclear to me: it
> seems like atomic variables will be annotated as such
> (atomic<int>). But I found no proposal for annotation of
> non-atomic objects that are protected by the ordinary locks (like
> mutexes). Will the compiler be forbiden to do all speculative
> stores, or how will it recognize shared objects as such?
In practice, gcc will provide a variable attribute to mark the
variable as atomic.
The language standard does not forbid speculative stores to non-atomic
objects.
Ian
More information about the Gcc
mailing list