[Insight-developers] Warnings after recent changes to ImageRegionExclusionConstIteratorWithIndex

Cory Quammen cquammen at cs.unc.edu
Tue Sep 20 13:14:46 EDT 2011


Bill,

To reproduce these warnings, I added -Wstrict-overflow=1. It produces
only a subset of the errors you cite. Upping the warnings to
-Wstrict-overflow=3 produces all kinds of warnings all over the
toolkit about the compiler assuming that no overflow will occur.

I tried refactoring ImageRegionExclusionConstIteratorWithIndex to
inherit from ImageRegionConstIteratorWithIndex so that I could use
directly its operator++() and operator--() methods instead of copying
the code in those methods to helper methods in
ImageRegionExclusionConstIteratorWithIndex, which is what I had in my
patch that was recently merged. With the inheritance approach, the
compiler warning about assuming no overflow occurs still exists, but
now it comes from ImageRegionConstIteratorWithIndex, code that I
haven't touched. I posted a patch for this change here:
http://review.source.kitware.com/#change,2831

In any case, I'm puzzled why only my changes produce this warning on
that machine when it seems there should be warnings all over ITK.
Perhaps compiler optimization is behind this?

I don't really know how to get rid of this warning. Adding manual
checks for overflow does not seem to work. I'd appreciate any help
anyone would like to offer.

Thanks,
Cory

On Mon, Sep 19, 2011 at 10:28 AM, Cory Quammen <cquammen at cs.unc.edu> wrote:
> Bill,
>
> Thanks, I'll look into it. The strange thing is that the code causing
> the error is copy-and-pasted from another iterator, and the original
> code I copied is not giving a warning. I'll see if I can refactor to
> call that code rather than copy it.
>
> Cory
>
>
> On Sun, Sep 18, 2011 at 2:52 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> Cory,
>>
>> This recent commit:
>> http://itk.org/gitweb?p=ITK.git;a=commit;h=48d699268487955c111274cccdc4430e226c5f52
>> may be causing these warnings:
>> http://www.cdash.org/CDash/viewBuildError.php?type=1&buildid=1543054
>>
>> Bill
>>
>>
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill
>



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill


More information about the Insight-developers mailing list