I'm getting a "dereference of null pointer" warning from the Clang static
analyzer (checker-270 on MacOS) that I don't understand. A simplified example
is:
=========================
void set_x1(int *&);
void set_x2(void *&);
int foo(void)
{
int *x = 0, *y = 0;
set_x1(x);
set_x2((void *&)y);
return *x + *y;
}
=========================
When I run "scan-build c++ -c" on this file, it complains about the dereference
of y, but not x. Should there be a difference between these two cases?
On a related note, it appears that the analyzer assumes that a function like
set_x1 will always set the argument to a non-NULL value (presumably unless it
can see the source and know otherwise). Is that the best assumption and are
such assumptions made by the analyzer documented anywhere?
Thanks,
Michael
_______________________________________________
cfe-users mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users