[Insight-developers] CastImageFilterTest failures

Cory Quammen cquammen at cs.unc.edu
Mon Jun 6 12:38:02 EDT 2011


On Sun, Jun 5, 2011 at 7:16 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Cory, Bill,
>
> One of the systems where this tests is failing is
> zion.kitware. This is a 32bits system with gcc 4.4.
>
> I just spent some quality time with the test, and it
> seems that the failure only occurs when compiling
> for Release.

Thanks for taking the time to do this, Luis.

> The build for Debug, and the build without optimization
> let the test pass.
>
> --
>
> Under Release the failure is quite curious because
> if you repeat the check comparing the two float values
> it returns alternatively true and false (as shown in the
> attached code).
>
> It looks like a bug of the compiler optimization.
>
>
> I suggest that we use CMake property flags for
> excluding this .cxx from optimization at compilation
> time.
>

That sounds reasonable to me.

I'll work on a patch.

Cory

>
>    Luis
>
>
> -----------------------------------
> On Fri, Jun 3, 2011 at 9:48 AM, Cory Quammen <cquammen at cs.unc.edu> wrote:
>> Bill,
>>
>> This is a very strange problem on some systems. Somehow, the
>> static_cast in the Cast functor in itkCastImageFilter.h produces
>> different results than the static_cast in my test when casting from
>> float to int.
>>
>> Basically, if you have
>>
>> int a = ...;
>> float b = ...;
>>
>> b = static_cast< float >( a );
>> b == static_cast< float >( a );
>>
>> the equality test in the last line of code can be false! This
>> frightens and confuses me.
>>
>> My last change to the test fixed the error on MSVC by storing the
>> static_cast result in a temporary variable and then doing an equality
>> test between the temporary to the output of the CastImageFilter, but
>> it obviously didn't fix it everywhere.
>>
>> I have no idea why the test is failing. Maybe one of the static_casts
>> is casting from a higher-precision register than the other. I've
>> Googled for similar problems reported elsewhere, but haven't found
>> anything yet.
>>
>> For now, should I disable the float-to-int cast test to make the
>> dashboard green?
>>
>> I have no idea why the test seems to be completely failing on SunOS.
>>
>> Gaetan,
>>
>> I'd be grateful if you could run the CastImageFilterTest in a debugger
>> and send me the stack trace when it segfaults. To minimize the time
>> you spend on this, the commands should be:
>>
>> cd $ITK_BUILD
>> gdb bin/ITK-ImageFilterBaseTestDriver
>> r itkCastImageFilterTest
>>
>> Thanks,
>> Cory
>>
>>
>> On Fri, Jun 3, 2011 at 8:35 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> Cory,
>>>
>>> CastImageFilterTest is failing on 3 platforms:
>>> http://www.cdash.org/CDash/testSummary.php?project=2&name=itkCastImageFilterTest&date=2011-06-03
>>>
>>> The two linux platforms are failing on
>>> Casting from int to float ... [FAILED]
>>>
>>> The Sun system is seg faulting.
>>>
>>> Bill
>>>
>>
>>
>>
>> --
>> Cory Quammen
>> Computer Integrated Systems for Microscopy and Manipulation (CISMM)
>> Department of Computer Science
>> University of North Carolina at Chapel Hill
>> http://www.cs.unc.edu/~cquammen
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>



-- 
Cory Quammen
Computer Integrated Systems for Microscopy and Manipulation (CISMM)
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen


More information about the Insight-developers mailing list