Array out of bounds warning
Falk Hueffner
falk.hueffner@student.uni-tuebingen.de
Mon Jul 31 11:19:00 GMT 2000
Jeffrey A Law <law@cygnus.com> writes:
> In message < 87d7jv8i9p.fsf@student.uni-tuebingen.de >you write:
> > Hi,
> >
> > the Compaq C compiler has a warning for an array out of bounds access
> > with constant index (and known array size, of course), like this:
> >
> > int a[10];
> > a[10] = 17;
> >
> It might make more sense to put this in expr.c so that other languages
> can get similar checks.
Ok, thanks for pointing this out. I'll try that.
> You might also check that the low bound is within range.
Well, for C this already was the case, since it seems integer
constants at that point had already been casted to unsigned, which
would also trigger that warning.
Falk
More information about the Gcc
mailing list