[Insight-developers] Cancelling Tag for today due to UnacceptableDashboard Status

Sean McBride sean at rogue-research.com
Tue Jan 31 12:29:52 EST 2012


On Mon, 30 Jan 2012 15:42:39 -0500, Bradley Lowekamp said:

>> 3) I'll handle itkSimpleImageRegistrationTest. One site is returning
>Completion Status of "Completed (ILLEGAL)". What does that mean? (http://
>www.cdash.org/CDash/testDetails.php?test=132953889&build=1960294)
>
>That is the clang compiler.... which I don't know if we are compliant
>enough with yet.

I maintain that dashboard.  "ILLEGAL" means that the compiler has deliberately generated an illegal CPU opcode so that the code would crash.  It did this because it detected that some undefined behaviour was invoked.  Since, by definition, undefined behaviour is undefined, the compiler is technically free to generate whatever code it wants.  As a debugging aid, it generated illegal code.  See here:

<http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html>
<http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html>
<http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html>

(long but a highly recommended read IMHO.)

I ran that test in gdb, and:

Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
itk::ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader<itk::ImageToImageMetricv4<itk::Image<float, 2u>, itk::Image<float, 2u>, itk::Image<float, 2u> >, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<float, 2u>, itk::Image<float, 2u>, itk::Image<float, 2u> > >::ComputeInformationFromQueues (this=0x103a05740, scanIt=@0x7fff5fbfc958, scanMem=@0x7fff5fbfc688) at itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader.hxx:372
372	  LocalRealType fixedMean  = sumFixed  / count;

(gdb) p sumFixed
$1 = 0
(gdb) p count
$2 = 0
(gdb) l
367	    ++itFixed;
368	    ++itMoving;
369	    ++itFixedMoving;
370	    }
371	
372	  LocalRealType fixedMean  = sumFixed  / count;
373	  LocalRealType movingMean = sumMoving / count;
374	
375	  LocalRealType sFixedFixed = sumFixed2 - fixedMean * sumFixed - fixedMean * sumFixed
376	    + count * fixedMean * fixedMean;

I assume "LocalRealType" is float/double?, in which case it's trying to do 0.0/0.0.

Technically, this is undefined in C++:

C++98 5.6 Multiplicative operators [expr.mul]p4 says , "If the second operand
of / or % is zero the behavior is undefined".  It's the same in C++11 N3242. 
Floating point division is not distinguished from integral division.

But with IEEE-754, division by zero is well-defined.  I'd wager few care about non-IEEE-754, and so view this as a false positive from clang, see my bug entry:

<http://llvm.org/bugs/show_bug.cgi?id=11854>

If ITK is actually meant to work on non-IEE-754 or if "LocalRealType" is an integer type, then this should be fixed.

-- 
____________________________________________________________
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 Insight-developers mailing list