Hello, If I try to use the size_t type for array indices in a cocci script, I get an error. For example:
foo.cocci: @@ type T; identifier x, y; @@ - T y; + size_t y; ... x[y] foo.c: int main(void) { int i = 2; int x[] = {1,2,3}; x[i] = 4; return 0; } $ spatch --sp-file foo.cocci foo.c size_t Fatal error: exception Failure("line 8: bad type for an array index") But size_t is perfectly valid, and even recommended.[1] I'm not familiar with the Coccinelle code but may I suggest the attached patch? Thanks for your time. [1] https://www.securecoding.cert.org/confluence/display/seccode/INT01-C.+Use+rsize_t+or+size_t+for+all+integer+values+representing+the+size+of+an+object
cocci-allow-size_t-array-index.patch
Description: Binary data
_______________________________________________ Cocci mailing list Cocci@diku.dk http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)