[ITK Community] [Insight-developers] GCC 4.8.2 compiler warning

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Nov 27 07:46:20 EST 2013


There are two loops which look like this:

https://github.com/Kitware/ITK/blob/master/Modules/Core/Common/include/itkImageAlgorithm.hxx#L148

 for ( unsigned int i = movingDirection; i + 1 < _RegionType::ImageDimension; ++i )

The use of the +1 there with the loop control variable is a little odd, but it was done to avoid a -1, and signed/unsigned interaction. I'd be curious of changing that made this warning go away, in exchanged for the signed/unsigned comparison warning.

Brad

On Nov 27, 2013, at 7:33 AM, "Johnson, Hans J" <hans-johnson at uiowa.edu> wrote:

> Thanks Brad.
> 
> 
> I too am beginning to think this compiler warnings are incorrect.
> 
> Hans
> 
> 
> On 11/27/13, 6:31 AM, "Bradley Lowekamp" <blowekamp at mail.nih.gov> wrote:
> 
>> Hans,
>> 
>> I have looked into this issue a couple times. It shows up on the Debian
>> sid (unstable) nightly build:
>> http://open.cdash.org/viewBuildError.php?type=1&buildid=3116766
>> 
>> The code in the ImageAlgorithm looks correct and no other system has
>> issues. Even VS debug which adds buffer over run check is OK.
>> 
>> Given that the error does not include line number, I figured it's deep in
>> the optimization phases of the compiler. I think the issue is with the
>> compiler.
>> 
>> That being said, you might be able to move a couple lines and statements
>> around to get rid of the warning. But I have not seen any issue with the
>> logic.
>> 
>> Brad
>> 
>> On Nov 26, 2013, at 8:41 PM, "Johnson, Hans J" <hans-johnson at uiowa.edu>
>> wrote:
>> 
>>> 
>>> I¹m getting the following warning on gcc 4.8.2:
>>> 
>>> In file included from
>>> /tmp/src/ITK/Modules/Core/Common/include/itkContinuousIndex.h:22:0,
>>>                from
>>> /tmp/src/ITK/Modules/Core/Common/include/itkImageRegion.h:34,
>>>                from
>>> /tmp/src/ITK/Modules/Core/Common/include/itkImage.h:21,
>>>                from
>>> /tmp/src/ITK/Modules/Core/Common/include/itkImageSource.h:32,
>>>                from
>>> 
>>> /tmp/src/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter
>>> .h
>>> :21,
>>>                from
>>> 
>>> /tmp/src/ITK/Modules/Core/Mesh/test/itkTriangleMeshToBinaryImageFilterTes
>>> t3
>>> .cxx:19:
>>> /tmp/src/ITK/Modules/Core/Common/include/itkIndex.h: In static member
>>> function Œstatic void itk::ImageAlgorithm::DispatchedCopy(const
>>> InputImageType*, OutputImageType*, const typename
>>> InputImageType::RegionType&, const typename
>>> OutputImageType::RegionType&,
>>> itk::ImageAlgorithm::TrueType) [with InputImageType =
>>> itk::Image<unsigned
>>> char, 3u>; OutputImageType = itk::Image<unsigned char, 3u>; typename
>>> InputImageType::RegionType = itk::ImageRegion<3u>; typename
>>> OutputImageType::RegionType = itk::ImageRegion<3u>;
>>> itk::ImageAlgorithm::TrueType = std::tr1::integral_constant<bool,
>>> true>]¹:
>>> /tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:
>>> array
>>> subscript is above array bounds [-Warray-bounds]
>>>  { return m_Index[dim]; }
>>>                  ^
>>> /tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:
>>> array
>>> subscript is above array bounds [-Warray-bounds]
>>> /tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:
>>> array
>>> subscript is above array bounds [-Warray-bounds]
>>>  { return m_Index[dim]; }
>>>                  ^
>>> 
>>> It looks serious to me, but I don¹t know how to decipher it.
>>> 
>>> 
>>> I¹m not going to be able to look at this anytime soon.
>>> 
>>> Hans
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ________________________________
>>> 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.
>>> ________________________________
>> 
> 
> 
> 
> ________________________________
> 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.
> ________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20131127/f3956fcd/attachment.html>
-------------- next part --------------
_______________________________________________
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://www.itk.org/mailman/listinfo/insight-developers


More information about the Community mailing list