http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
Danilo <zweifel at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #10 from Danilo <zweifel at gmail dot com> 2010-10-20 14:45:18 UTC --- (In reply to comment #8) > 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 Thanks you very much, Jonathan! I will surely read the references. I am considering this as closed.