Related articles |
---|
array bounds checking drizzle76@gmail.com (dz) (2005-11-26) |
Re: array bounds checking nmm1@cus.cam.ac.uk (2005-11-27) |
Re: array bounds checking sudeshc@noida.hcltech.com (Sudesh Chandna, Noida) (2005-11-29) |
Re: array bounds checking gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-12-03) |
Re: array bounds checking neal.wang@gmail.com (2005-12-08) |
Re: Array bounds checking pardo@june.cs.washington.edu (1990-06-15) |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.