PATCH: BPs & cleanups for ARRAY_SIZE
Raja R Harinath
harinath@cs.umn.edu
Wed Aug 23 12:11:00 GMT 2000
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
More information about the Gcc-patches
mailing list