On Fri, 16 Nov 2001, Frank Heckenbach wrote:
I.e., it has to resolve equations!? (If a is an array [1 .. 20] and in the loop it says `a [i * i - 3]', it should find that i is allowed to be in the range 2 .. 4 and -4 .. -2?
Horrors. If i is a subrange, the compiler can calculate (mini * mini - 3) and (maxi * maxi - 3). If these are satisfactory then it omits the range checks on the index operation.
Nice, but wrong (e.g.: i: -4 .. 4)!
IMHO such min-max analisys is feaible: for exmaple, compiler knows (or can be made that way) that by multiplying x*x you get a positive number (except for complex numbers, of course).
So, if range is -4 .. 7, x*x falls into 0 .. max(abs(x))
mirsad
-- This message has been made up using recycled ideas and language constructs. No plant or animal has been injured in process of making this message.