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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-20 
14:40:21 UTC ---
I don't recommend people use volatile to avoid multithreading races, it only
prevents compiler optimisations, not hardware reordering. Using proper atomics,
memory barriers or other explicit synchronisation is better.
But for this testcase, yes, volatile will "fix" it.

Danilo, you might like to read these
http://www.drdobbs.com/cpp/201804238
http://www.drdobbs.com/high-performance-computing/212701484

Reply via email to