[cfe-dev] RFC on array-bounds patch
Dmitri Gribenko
gribozavr at gmail.com
Mon Feb 17 12:26:28 PST 2014
On Mon, Feb 17, 2014 at 6:29 PM, Daniel Marjamäki
<Daniel.Marjamaki at evidente.se> wrote:
> Hello!
>
> Here is a patch that will make Clang warn when there is this index out of
> bounds:
>
> void f(int x) {
> int a[10];
> if (x >= 10)
> a[x] = x;
> }
>
> The checkLocation is not triggered on the "a[x] = x;" statement. Is this by
> design? Is the checkPrestmt a good choice or would it be better to choose
> some other check type?
+ Jordan
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-dev
mailing list