Re: array bounds checking

"Sudesh Chandna, Noida" <>
29 Nov 2005 16:09:05 -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: "Sudesh Chandna, Noida" <>
Newsgroups: comp.compilers
Date: 29 Nov 2005 16:09:05 -0500
Organization: Compilers Central
References: 05-11-121
Keywords: debug
Posted-Date: 29 Nov 2005 16:09:05 EST


> I am wondering if anybody knew how array bounds checks worked when
>they are references through multiple indirections of pointers. Eg: p =
>A ; q= &p; ***q+100=0; So q is referencing A. And hence I would like a
>check inserted there.
>                   Do array bounds checking handle these cases, because
>this also would need pointer analysis.

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.

This information can be used at runtime to do bounds checking.

Thanks & Best Regards,
Sudesh Chandna
Senior Member Technical Staff

Post a followup to this message

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