http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46096
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot | |gnu.org --- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2010-10-20 14:34:40 UTC --- > Using a mutex around the reads and writes of shared data will make it work as > expected, the compiler won't optimise away the read and will re-read the value > every time. This is overkill here though, you just need: volatile alpha *alpha1 = ( alpha * )data;