[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: Array out of bounds warning
From:       Falk Hueffner <falk.hueffner () student ! uni-tuebingen ! de>
Date:       2000-07-31 17:42:20
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic