False Positives when Boost::shared_ptr is used with Inspector?

False Positives when Boost::shared_ptr is used with Inspector?

Hi Folks,

I've downloaded the 30 day trial for Parallel Studio. It has helped me find a few bugs, but when I started to analyse stack accesses it seems to have produced a lot of false positives. Here is an example

void DriveTrain::finalise()

It has reported an "Uninitialized Memory Access" on the last line (_diff->FixLinkParams()). _diff is created in the constructor, it is a boost::shared_ptr

[cpp]int PhyConstraint::FixLinkParams()
	gunsigned i;
	for(i=0;i In the FixLinkParams method I'm sure that NRigidBody and ppRigidBody are initialised.

Am I missing something or is there a problem here?

Thanks for your help
All the best,Ash
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Ash-
Is Parallel Inspector reporting the problem as being inside the function FixLinkParams() or at the point when you are dereferencing _diff (line 6. of finalise()?) And is any of _diff or that which _diff points to allocated on the stack? (For anything not on the stack the "uninitialized memory access" diagnostic should be giving you the code location where the object was allocated.)

Hi Matt,Thanks for the reply,

It is at the point of dereferencing _diff. Diff is created in the constructor like so: -

_diff = boost::shared_ptr(new PhyDifferentialConstraint());

This error isn't reported when I run the test without ticking the "Analyse Stack Accesses". It doesn't show the point of allocation with the error, so it must think there is a problem with the stack. This is why I thought perhaps it was having difficulties with the boost::shared_ptr.

I am new to this, so I thought perhaps I was doing something incorrectly.

Thanks for your help
All the best,

Hi Matt,

I did a little experiment, I changed _diff to use a normal pointer and the error no longer is reported. There is an error reported for the other 3 lines (engine / driveshaft / gearbox) - they are using boost::shared_ptr.

So it looks like either there is a problem with boost::shared_ptr or it is a false positive.
Is there any way to ignore all the errors reported for boost::shared_ptrs? I am getting a couple of hundred problems.
Thanks for your helpAll the best,
PS. The forum post editor is a bit useless :) (in Chrome at least) - I have to use shift+enter to get a line break

Hi Matt,

I tried _diff with the new std::shared_ptr and it seems to work (i.e. not reporting an error), seems to be boost::shared_ptr it has a problem with

All the best,Ash

Leave a Comment

Please sign in to add a comment. Not a member? Join today