This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Array out of bounds warning
- To: gcc at gcc dot gnu dot org
- Subject: Re: Array out of bounds warning
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- Date: 31 Jul 2000 19:42:20 +0200
- References: <15088.965052644@upchuck>
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