[vtk-developers] Need help with a few clang analyzer warnings

Sean McBride sean at rogue-research.com
Fri Nov 21 11:46:11 EST 2014


Hi all,

Occasionally, I try to fix some of the hundreds of clang static analyzer warnings in VTK.  Some are easy, some are false positives, and some are real problems that I don't know how to fix.  I'd like to appeal to you all to help fix these 3:

1)
file: Common/DataModel/vtkPolyLine.cxx
method: vtkPolyLine::GenerateSlidingNormals
lines: 227-237
problem: dead code.  The "if ( largeRotation )" branch sets "theta" then nothing uses it.

2)
file: Rendering/Core/vtkCellPicker.cxx
method: vtkCellPicker::IntersectVolumeWithLine
line: 691
problem: the 'property' pointer is initialized to null, and if the subsequent 'if' is not entered, it's certainly still null at line 691 and dereferenced.

3)
file: Common/DataModel/vtkKdTree.cxx
line: 3188
method: vtkKdTree::GenerateRepresentationWholeSpace
problem: the first time through the 'for' loop always does "1 << -1".  You can't left shift by a negative count.

I don't want to blindly delete dead code that maybe shouldn't be dead, or just throw in null checks, so hopefully someone knows this code!

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list