Created attachment 6919
test case
Using downloaded build checker-257, if I assign a variable the contents of
'this', then change that variable as if it were stepping along a linked list, I
get a false positive dereference of a null pointer of 'this'.
The attached test case shows the original code (ifdefed out), plus a simplified
version. Here is a snippet of it, but the attached file is a complete
compilable demonstration. 'this' is never 0.
{
const A *a = this;
if (a != 0)
a = a->m_previous;
printf("%d", m_variable);
}
/Users/piers/a/test.cpp:31:18: warning: Access to field 'm_variable' results in
a dereference of a null pointer
printf("%d", m_variable);
^
(the second warning about an unused variable can be safely ignored and only
exists to keep the case simple)
test.cpp
(377 bytes, application/octet-stream)