This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Array out of bounds warning


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]