------- Comment #25 from ebotcazou at gcc dot gnu dot org 2009-02-26 08:26 ------- > Also, you can have the same problem with this kind of code without threads. > Imagine, for example, if the 'shared_variable' may be in read-only memory and > 'can_write' indicates this case.
Then it must be declared 'volatile'. This optimization is valid in ISO C if the variable is not declared so. Of course that's orthogonal to this PR. -- ebotcazou at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31862