[ITK] [ITK-dev] Bug in the library, or just in the test..?

Johnson, Hans J hans-johnson at uiowa.edu
Fri Oct 23 14:13:06 EDT 2015


This is not a bug in std::fill_n

The bug is “&this->m_Data[0]”.

I think that we need to check for this degenerate case.

I pushed an initial patch to review:  http://review.source.kitware.com/#/c/20307/

Hans




On 10/23/15, 12:33 PM, "Insight-developers on behalf of Luc Hermitte" <insight-developers-bounces at itk.org on behalf of luc.hermitte at c-s.fr> wrote:

>Hi,
>
>Le 23/10/2015 18:43, David Cole via Insight-developers a écrit :
>> The itkTransformTest is the only test failing on my Visual Studio 2013
>> Debug dashboard because of this code:
>
>What is the exact error produced when your run the test in verbose mode?
>
>
>> The problem is in the Fill implementation:
>>
>>     template< typename TValue >
>>     void VariableLengthVector< TValue >
>>     ::Fill(TValue const & v) ITK_NOEXCEPT
>>     {
>>       std::fill_n(&this->m_Data[0], m_NumElements, v);
>>     }
>>
>> In this test call, m_Data is nullptr, and m_NumElements is 0, so
>> clearly,&m_Data[0] is not a useful pointer, and with 0 elements, there
>> is nothing to fill.
>>
>> So.... should the implementation of Fill be changed to be conditional
>> on the pointer being non-nullptr, or the number of elements being
>> non-zero, or both? (Are other Fill implementations protected like so?)
>>
>> Or should the test be changed to avoid calling Fill when there are no
>> elements...?
>
>I'd say that this is a bug in std::fill_n (or something related to the
>STL being in CHECKED MODE) and that we should fall back into a plain
>loop. We should avoid adding such defensive tests (if (!empty) fill_n()).
>
>I can take care of this issue (only on Monday). If you don't mind, I'd
>rather avoid rebasing yet another time and first go through
>http://review.source.kitware.com/#/c/20253/10 (I could also fix the
>issue I've introduced in my first patch on VLV in this patch, but this
>is not the usual patching policy if I understand correctly)
>
>
>Regards,
>--
>Luc Hermitte
>_______________________________________________
>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.php
>
>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://public.kitware.com/mailman/listinfo/insight-developers


________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
_______________________________________________
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.php

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://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list