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

Sean McBride sean at rogue-research.com
Wed Dec 3 12:08:06 EST 2014


Thanks David for fixing #2, and thanks Dan Lipsa for doing #3.

Anyone know vtkPolyLine.cxx to look at #1?

And to add a #4:

Common/ExecutionModel/vtkCompositeDataPipeline.cxx:1047:5: Value stored to 'outputPort' is never read

The whole block of code seems pointless because nothing actually uses 'outputPort' after setting it.

// Save the information about COMPOSITE_INDICES() as needed in the data
// object.
int outputPort = 0;
if(request->Has(FROM_OUTPUT_PORT()))
  {
  outputPort = request->Get(FROM_OUTPUT_PORT());
  outputPort = (outputPort >= 0 ? outputPort : 0);
  }

Thanks,

Sean


On Fri, 21 Nov 2014 10:20:54 -0700, David Gobbi said:

>Hi Sean,
>
>I can fix vtkCellPicker.cxx by making the code able to handle the
>case that property is null.
>
> - David
>
>
>On Fri, Nov 21, 2014 at 9:46 AM, Sean McBride <sean at rogue-research.com>
>wrote:
>
>> 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!




More information about the vtk-developers mailing list