[cfe-dev] New dereference pointer check
Anders Rönnholm
Anders.Ronnholm at evidente.se
Fri Apr 25 03:30:34 PDT 2014
Hi,
I intend to do a new dereference check. Much like the "division by zero then check" check i have started on.
e.g
void foo0(int *p, int a) {
*p = 0;
if (p == 0) {} // expected-warning {{Possible null pointer dereference: p - otherwise it is redundant to check it against null}}
}
I plan to do it the same way:
1. When a dereference is made store the value to the program state.
2. When reaching a condition that checks if a value is 0, check if the value has been dereferenced in the same scope previously.
3. Report bug
Is this a check you would be interested in having?
//Anders
More information about the cfe-dev
mailing list