On Sat, 13 Nov 2010, Vasiliy Kulikov wrote: > Hi, > > I cannot understand why it happens: > > @@ > expression x; > expression E; > identifier free ~= "^kfree$\|^kput$\|^put_device$\|^input_unregister_device$"; > @@ > > *free(x); > ... when != x > ( > x = E > | > * x > ) > > --- main.c 2010-11-13 14:16:31.000000000 +0300 > +++ /tmp/cocci-output-18580-98aa90-main.c 2010-11-13 > 14:18:27.000000000 +0300 > @@ -16,8 +16,6 @@ main(int argc, char **argv) > void *x; > void *y; > > - for (x = &y; x == &y; x = &y) > - kfree(x);
Spatch doesn't know about the order of evaluation between the subterms of a for loop header. You can avoid the problem by making your disjunction: ( for(...;...;x = E) S | x = E | * x ) where S is a statement metavariable. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
