i don't get the expected result , because my goal is to detect the overflow
of the array size.
when we have a defined array, when we access to this array the script must
print a warning when the index is superior to the size of the array. this
index can be a constant or a variable. the script must detect all the
possible cases of the array size overflow.

2015-05-22 7:47 GMT+02:00 SF Markus Elfring <[email protected]>:

> > i tried this script
> >
> > @r@
> > position p1;
> > identifier  arr;
> > constant i , var;
> > type T;
> > @@
> >  T arr[var];
>
> Does this SmPL approach work a bit as you expect?
> Which details did not satisfy you so far?
>
>
> > ... when != (i < var/ )
>
> How do you think about to omit parentheses here?
>
>
> > ...
> > * arr[i]@p1
>
> Would you like to reuse the data from the position variable anywhere?
>
> How do you want to handle scopes for the involved array indexes?
> http://en.cppreference.com/w/c/language/scope
>
> Regards,
> Markus
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to