This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: confused at code generation for a empty loop


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]