PRC wrote: > while( flag == 0 ) ; > I wonder why gcc generates code for a empty loop like that. Is it a bug or for optimization in some case? > This subject has been debated at length, and some programmers rely on the current gcc treatment. More programmers rely on loops whose exit condition should not be optimized away, but does get "optimized" away by unsafe "optimizations" by certain compilers, including gcc -ffast-math.