Satish has kindly set up having the Clang static analyzer run on all PETSc 
code during our testing. You can find links to the output of the analyzer on 
the seventh row of the dashboard (accessible from 
ftp://ftp.mcs.anl.gov/pub/petsc/nightlylogs/index.html) as 

linux-analyzer_crush [B] [E]

The B points to the problems detected in the source code and the E to problems 
in the examples.

   Though some of you believe that static analyzers produce tons of false 
positives I have already looked through and fixed a multitude of problems (some 
that had been in the code for at least a decade) and I have detected very few 
false positives.

   Please look through the output and try to fix ones you see in portions of 
the code you frequent. By clicking on the 

View Report

buttons on the right side of the screen for each issue you can see exactly why 
the static analyzer thinks there is a problem.

Notes:  Please do not blindly initialize a variable to zero if the static 
analyzer states it is used uninitialized; this may actually conceal a bug where 
the value should have been set in the logic and was not. So make absolutely 
certain that it is a false warning before you do such an initialization.

"PETSc style" asserts can be used in the code to eliminate paths that you know 
will not exist in the code and remove clang analyzer warnings. For example you 
could add a

if (x < 0.0) SETERQ(...) 

if you know that x cannot be negative and the analyze gives you a warning when 
it is negative.

Since many issues are found at the moment by the analyzer the Dashboard does 
not automatically send email to let you know about them. The Dashboard will 
continue to send email about all issues found by the compilers (including 
seemingly a single false positive that goes to Toby). Once we have eliminated 
most analyzer warnings we may turn on the automatic email for them so people 
are quickly warned about new issues they have introduced.

Final note: One of the best reasons to make PETSc code issue free with the 
clang static analyzer is that it will give us the right to criticize all other 
software projects that do not :-)


  Barry




Reply via email to