loop invariant code motion bug

Alexandre Oliva oliva@dcc.unicamp.br
Thu May 28 18:53:00 GMT 1998


Nick Mitchell <mitchell@cs.ucsd.edu> writes:

> normally, it would be fine to move loads/compares of the two variables
> out of the loop. However, if the program is *multi-threaded*, this
> code motion may not be correct:

You must declare variables volatile if you want to ensure that the
compiler won't optimize away multiple loads of a variable.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list