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: -funsafe-loop-optimizations


On Jan 1, 2005, at 2:05 PM, Zdenek Dvorak wrote:
Hello,

Is it maybe possible in some cases to look at how the induction
variable is used (e.g. as an array index and we know that it is
undefined to have an index outside the array domain), and decide
on whether the loop must be finite or not based on that?

we do this on tree level.

The standard also limits how big an object can be (more exactly, does not
require a compiler to handle bigger objects). So if the overflow case would
result in addressing a bigger object, we can assume that doesn't happen,
even if we don't know how big the allocated size was. (There are cases in
Spec where the allocated size is read in from a file, so even whole-program
opt can't find it.) This is true even when the object access isn't connected
to the index variable, for example:


   for (p=0, i=1; i<=n; i++)
     foo (*p++) ;

The limit in the standard is 64K-1 bytes, but as a practical matter it would
certainly be wise to pick a larger limit, possibly target-dependent.



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