|array index checking optimizations? email@example.com (1996-04-29)|
|Re: array index checking optimizations? firstname.lastname@example.org (1996-04-30)|
|Re: array index checking optimizations? email@example.com (1996-04-30)|
|Re: array index checking optimizations? firstname.lastname@example.org (1996-05-01)|
|Re: array index checking optimizations? Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) (1996-05-01)|
|Re: array index checking optimizations? email@example.com (1996-05-01)|
|array index checking optimizations? firstname.lastname@example.org (Dave Lloyd) (1996-05-02)|
|[6 later articles]|
|From:||email@example.com (Stephen Adams)|
|Date:||29 Apr 1996 23:03:23 -0400|
|Organization:||MIT Project MAC|
I am curious if there are any compilers out there that can detect that
all the array references in the following program are safe, and thus
no array indexes need to be checked.
If such a compiler exists:
1. How does the analysis determine that the array indexes
are in range?
2. How fragile is the analysis, for example, does it still
work if the condition in the while loop is changed to
`while i <> last do'
If not, how close is the state of the art to being capable of this
There seem to be relatively few papers on array bounds checking in the
literature (for example, only a handful in the past 10 years in PLDI).
Most of the material that I have read will work only for simple DO
loops, or fails to incorporate information from control flow.
[I apologise for the program being a mix of Pascal, Ada, etc. I think
that what it does is reasonably apparent.]
function compare (a : array of char, b : array of char) returns integer
var last : integer;
var i : integer := 0;
if a'length < b'length then
last = a'length
last = b'length
while i < last do
if a[i]=b[i] then
i := i + 1;
return ord(a[i]) - ord(b[i]);
return a'length - b'length
[Didn't the PL.8 compiler optimize this kind of stuff? -John]
Return to the
Search the comp.compilers archives again.