Re: array bounds checking

glen herrmannsfeldt <>
3 Dec 2005 16:23:39 -0500

          From comp.compilers

Related articles
array bounds checking (dz) (2005-11-26)
Re: array bounds checking (2005-11-27)
Re: array bounds checking (Sudesh Chandna, Noida) (2005-11-29)
Re: array bounds checking (glen herrmannsfeldt) (2005-12-03)
Re: array bounds checking (2005-12-08)
Re: Array bounds checking (1990-06-15)
| List of all articles for this month |

From: glen herrmannsfeldt <>
Newsgroups: comp.compilers
Date: 3 Dec 2005 16:23:39 -0500
Organization: Compilers Central
References: 05-11-121 05-11-135
Keywords: code, debug
Posted-Date: 03 Dec 2005 16:23:39 EST

Sudesh Chandna, Noida wrote:

> This can be easily done by having a data structure commonly known as
> "descriptor" for pointer which can hold lower bound, upper bound, stride
> corresponding to all dimensions of the array. Also descriptor should have rank
> ( dimension ) and address of the array. Now for languages such as FORTRAN
> where its possible to say

> Ptr => ary(1:10:2)

> Descriptor values lower bound would be 1
> Upper bound would be 5
> Stride would be say 8 (2*size of element)
> Rank would be 1
> And addr will hold starting address.

Ones I know store the virtual origin, the address of element (0,...,0).
It makes it easy to do the calculation, multiply the strides by the
subscripts and add. (After checking bounds.)

-- glen

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.