http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53436

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-22 
07:59:01 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > The testcase is not valid OpenMP, there is no flush operation in between the
> > store and reads, 
> 
> Is that also needed with volatile variables? Would be quite counterintuitive.

I believe so.  Volatile only makes sure the compiler emits a store of the
variable to memory, but the CPU can just store it into a cache.  There is
nothing that orders that store compared to other stores/loads.
So, just use the appropriate OpenMP directives for synchronization, rather than
bad attempts at busy waiting using volatile.

Reply via email to