[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ITK 4.1 patches for gcc 4.7



On Wed, 2012-06-13 at 02:13 -0500, Steve M. Robbins wrote:
> > SpatialObject-Test-Segfaults.patch: Fixes the segfaults, in the spatial
> > object tests.
> 
> The comment indicates "not 100% sure why this works. ComputeMatrix
> looks fine".  This sounds like it could be a work around for gcc bug?
> How many of these patches fix an identifiable bug in the ITK code?

Well, here is what I think is the problem:

template< class TScalarType, unsigned int NDimensions >
void
ScalableAffineTransform< TScalarType, NDimensions >
::ComputeMatrix()
{
  unsigned int i;

  for ( i = 0; i < NDimensions; i++ )
    {
    if ( m_Scale[i] != m_MatrixScale[i] )
      {
      break;
      }
    }
  if ( i < NDimensions )
    {
 
It just struck me as unusual, but completely valid, to use where 'i'
break-ed in the loop as a condition of the next if. My change just
removes the break and sets a bool. So this patch is probably getting
around a bug in the gcc optimization code, but the change makes the ITK
code a bit more readable, in my opinion. So worth changing.

The other patches are actual bugs in ITK code.
Fix-gcc-4.7FEM-Tests.patch fixes code that uses a pointer to an array
that is no longer in scope. Something that just worked with other
compiliers/optimizations. Probably because the memory was still intact,
but shouldn't be counted on.

And narrowing-conversion-warnings.patch fixes some warnings where there
are variables defined as ints when they should be unsigned ints. Nothing
too big, but actual defects in the ITK code.

> > Hopefully these fix some of the errors on the other architectures,
> > although I think i386 has more failures.
> 
> Yes, it does: http://open.cdash.org/viewTest.php?onlyfailed&buildid=2355571
> 
> Also note that the build with gcc 4.6 is failing on most architectures:
> https://buildd.debian.org/status/package.php?p=insighttoolkit4&suite=experimental
> 
> Help with this would be highly valued.

I'll try and build i386 sometime soon to see if I can find anything.

-Paul



Reply to: