This is the mail archive of the
mailing list for the GCC project.
On Jan 1, 2005, at 2:05 PM, Zdenek Dvorak wrote:
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
require a compiler to handle bigger objects). So if the overflow case
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
Spec where the allocated size is read in from a file, so even
opt can't find it.) This is true even when the object access isn't
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
certainly be wise to pick a larger limit, possibly target-dependent.