Open seanm opened 2 years ago
168f84f1ac3e209cc46d1c9b07a896fc895cdd8a looks to be related. So @thewtex maybe you have some idea for this one?
@seanm taking a look, it seems we should be calling:
this->m_FixedParameters.SetSize(NInputDimensions);
this->m_FixedParameters.Fill(0.0);
in:
template <typename TScalar, unsigned int NInputDimensions,
unsigned int NOutputDimensions>
MatrixOffsetTransformBase<TScalar, NInputDimensions, NOutputDimensions>
::MatrixOffsetTransformBase(const MatrixType & matrix, const OutputVectorType & offset)
{
m_Matrix = matrix;
m_MatrixMTime.Modified();
m_Offset = offset;
m_Center.Fill(0);
m_Translation.Fill(0);
for( unsigned int i = 0; i < NOutputDimensions; i++ )
{
m_Translation[i] = offset[i];
}
this->ComputeMatrixParameters();
}
but that may not be the source of this warning.
Thanks for looking into these static analysis issues.
Sorry, where is that code? I don't seem able to find it in master...
PS: TSan is not static analysis, it's a runtime checker.
Ah, quite different! I'll try adding those 2 lines...
@thewtex so I added those 2 lines at the end of that function, but alas it does not fix the TSan error.
@seanm could that fix please be submitted? It may not be the TSan error, but I think it is still a bug.
@thewtex ok will do. though I'll need help writing a commit message, since I don't know what I'm doing here.
Just looking at this again years later...
template <typename TParametersValueType, unsigned int VInputDimension, unsigned int VOutputDimension>
const typename MatrixOffsetTransformBase<TParametersValueType, VInputDimension, VOutputDimension>::FixedParametersType &
MatrixOffsetTransformBase<TParametersValueType, VInputDimension, VOutputDimension>::GetFixedParameters() const
{
for (unsigned int i = 0; i < VInputDimension; ++i)
{
this->m_FixedParameters[i] = this->m_Center[i];
}
return this->m_FixedParameters;
}
I'm confused: How can this method be const when it's mutating the thing it's returning?
@seanm could that fix please be submitted? It may not be the TSan error, but I think it is still a bug.
According to bc1bcae24435fd76c430180e709a50e920eba6f4,
itkTestTransformGetInverse
was added to demonstrate a threading bug.Seems it was never fixed though?
The test looks to me to be deliberately using
GetInverse
on a transform shared between threads.The root of the weridness, to me, comes from here where a getter method mutates the object.
Full TSan report: