This is the mail archive of the gcc@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: Loop oddity


> To: gcc@gcc.gnu.org
> Date: Tue, 22 Jan 2002 12:08:43 -0500 (EST)
> From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>

> Here is a loop oddity that I noticed.  The loop 

>   for (i = 1000000; i; i--) {};

> I noticed this trying to write a little program to check insn
> timing.  Thus, I didn't want the loop transformed.

You cannot rely upon gcc not optimizing it away completely.  Now is
the time to fix your code.  We suggest accessing a volatile object
inside the loop.


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