This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: BPs & cleanups for ARRAY_SIZE
- To: Greg McGary <greg at mcgary dot org>
- Subject: Re: PATCH: BPs & cleanups for ARRAY_SIZE
- From: Raja R Harinath <harinath at cs dot umn dot edu>
- Date: 23 Aug 2000 14:11:15 -0500
- Cc: gcc-patches at gcc dot gnu dot org
- References: <16791.967052717@upchuck> <mswvh726ld.fsf@mcgary.org>
Greg McGary <greg@mcgary.org> writes:
> Jeffrey A Law <law@cygnus.com> writes:
>
> > I'm not really sure I understand the benefit in optabs.c and emit-rtl.c,
>
> Those are the changes that avoid bounds violations. With BPs, array
> accesses are constrained to occur within the bounds of each dimension
> of the array. By treating a multi-dimensional array as flat, you
> break down its internal "walls".
But, isn't that allowed in C?
int a[3][3][3];
p = (int *) a;
'p' should get the same bounds as 'a':
[ (char *)a, (char *)a + 27*sizeof(int) )
Then, there's no violation of bounds if 'p' is stepped 27 times,
instead of nested loops.
- Hari
--
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash