<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hans,<div><br></div><div>That formatting was horrible, but I think I under stand your question..</div><div><br></div><div>Consider the loop at 148, for ImageDimension = 3:</div><div><br></div><div>for ( unsigned int i = movingDirection; i + 1 < _RegionType::ImageDimension; ++i )</div><div><br></div><div>This will iterate over with i = {0,1}, since 2+1 !< 3.</div><div><br></div><div>Therefore:</div><div><br></div><div>++inCurrentIndex[i + 1]</div><div><br></div><div>is maxed index at 2, which is in bounds.</div><div><br></div><div><br></div><div>As I said, I believe the code is correct. Its  just seems to be confusing to humans and compilers...</div><div><br></div><div>Brad</div><div><br></div><div><br></div><div><br></div><div><br><div><div>On Nov 27, 2013, at 9:48 AM, "Johnson, Hans J" <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<div style="word-wrap: break-word; font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Brad,</div>
<div><br>
</div>
<div>That does look wrong.</div>
<div><br>
</div>
<div>At line #148 should (<span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">+</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span class="mi" style="color:rgb(0,153,153); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">1</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre"><</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">_RegionType</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">::</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">ImageDimension)
 -> (</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre"><</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)">
</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">_RegionType</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">::</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">ImageDimension
 – 1 </span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">)</span></div>
<div><br>
</div>
<div>At line #154, should the (<span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">++</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">inCurrentIndex</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">[</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">
</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">+</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">
</span><span class="mi" style="color:rgb(0,153,153); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">1</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">];)
 be ( if( i < </span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">_RegionType</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">::</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">ImageDimension
 – 1 ) {</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">++</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">inCurrentIndex</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">[</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">
</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">+</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">
</span><span class="mi" style="color:rgb(0,153,153); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">1</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,255)">];</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">}
 )</span></div>
<div><br>
</div>
<div><br>
</div>
<div>Hans</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223); ">
<span style="font-weight:bold">From: </span>Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, November 27, 2013 at 6:46 AM<br>
<span style="font-weight:bold">To: </span>Hans Johnson <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>><br>
<span style="font-weight:bold">Cc: </span>ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: GCC 4.8.2 compiler warning<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap:break-word">There are two loops which look like this:
<div><br>
</div>
<div><a href="https://github.com/Kitware/ITK/blob/master/Modules/Core/Common/include/itkImageAlgorithm.hxx#L148">https://github.com/Kitware/ITK/blob/master/Modules/Core/Common/include/itkImageAlgorithm.hxx#L148</a></div>
<div><br>
</div>
<div><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"> </span><span class="k" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">for</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">(</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="kt" style="color:rgb(68,85,136); font-weight:bold; font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">unsigned</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="kt" style="color:rgb(68,85,136); font-weight:bold; font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">int</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">=</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">movingDirection</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">;</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">+</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="mi" style="color:rgb(0,153,153); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">1</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre"><</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">_RegionType</span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">::</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">ImageDimension</span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">;</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="o" style="font-weight:bold; color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">++</span><span class="n" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">i</span><span style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre; background-color:rgb(255,255,204)"></span><span class="p" style="color:rgb(51,51,51); font-family:Consolas,'Liberation Mono',Courier,monospace; font-size:12px; line-height:18px; white-space:pre">)</span></div>
<div><br>
</div>
<div>
<div>
<div>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.</div>
<div><br>
</div>
<div>Brad</div>
<div><br>
</div>
<div>On Nov 27, 2013, at 7:33 AM, "Johnson, Hans J" <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">Thanks Brad.<br>
<br>
<br>
I too am beginning to think this compiler warnings are incorrect.<br>
<br>
Hans<br>
<br>
<br>
On 11/27/13, 6:31 AM, "Bradley Lowekamp" <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>> wrote:<br>
<br>
<blockquote type="cite">Hans,<br>
<br>
I have looked into this issue a couple times. It shows up on the Debian<br>
sid (unstable) nightly build:<br>
<a href="http://open.cdash.org/viewBuildError.php?type=1&buildid=3116766">http://open.cdash.org/viewBuildError.php?type=1&buildid=3116766</a><br>
<br>
The code in the ImageAlgorithm looks correct and no other system has<br>
issues. Even VS debug which adds buffer over run check is OK.<br>
<br>
Given that the error does not include line number, I figured it's deep in<br>
the optimization phases of the compiler. I think the issue is with the<br>
compiler.<br>
<br>
That being said, you might be able to move a couple lines and statements<br>
around to get rid of the warning. But I have not seen any issue with the<br>
logic.<br>
<br>
Brad<br>
<br>
On Nov 26, 2013, at 8:41 PM, "Johnson, Hans J" <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>><br>
wrote:<br>
<br>
<blockquote type="cite"><br>
Iım getting the following warning on gcc 4.8.2:<br>
<br>
In file included from<br>
/tmp/src/ITK/Modules/Core/Common/include/itkContinuousIndex.h:22:0,<br>
               from<br>
/tmp/src/ITK/Modules/Core/Common/include/itkImageRegion.h:34,<br>
               from<br>
/tmp/src/ITK/Modules/Core/Common/include/itkImage.h:21,<br>
               from<br>
/tmp/src/ITK/Modules/Core/Common/include/itkImageSource.h:32,<br>
               from<br>
<br>
/tmp/src/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter<br>
.h<br>
:21,<br>
               from<br>
<br>
/tmp/src/ITK/Modules/Core/Mesh/test/itkTriangleMeshToBinaryImageFilterTes<br>
t3<br>
.cxx:19:<br>
/tmp/src/ITK/Modules/Core/Common/include/itkIndex.h: In static member<br>
function Œstatic void itk::ImageAlgorithm::DispatchedCopy(const<br>
InputImageType*, OutputImageType*, const typename<br>
InputImageType::RegionType&, const typename<br>
OutputImageType::RegionType&,<br>
itk::ImageAlgorithm::TrueType) [with InputImageType =<br>
itk::Image<unsigned<br>
char, 3u>; OutputImageType = itk::Image<unsigned char, 3u>; typename<br>
InputImageType::RegionType = itk::ImageRegion<3u>; typename<br>
OutputImageType::RegionType = itk::ImageRegion<3u>;<br>
itk::ImageAlgorithm::TrueType = std::tr1::integral_constant<bool,<br>
true>]ı:<br>
/tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:<br>
array<br>
subscript is above array bounds [-Warray-bounds]<br>
 { return m_Index[dim]; }<br>
                 ^<br>
/tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:<br>
array<br>
subscript is above array bounds [-Warray-bounds]<br>
/tmp/src/ITK/Modules/Core/Common/include/itkIndex.h:226:19: warning:<br>
array<br>
subscript is above array bounds [-Warray-bounds]<br>
 { return m_Index[dim]; }<br>
                 ^<br>
<br>
It looks serious to me, but I donıt know how to decipher it.<br>
<br>
<br>
Iım not going to be able to look at this anytime soon.<br>
<br>
Hans<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
________________________________<br>
Notice: This UI Health Care e-mail (including attachments) is covered<br>
by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is<br>
confidential and may be legally privileged.  If you are not the intended<br>
recipient, you are hereby notified that any retention, dissemination,<br>
distribution, or copying of this communication is strictly prohibited.<br>
Please reply to the sender that you have received the message in error,<br>
then delete it.  Thank you.<br>
________________________________<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
<br>
________________________________<br>
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.<br>
________________________________<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span><br>
<br>
<hr>
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.
<hr>
</div>

</blockquote></div><br></div></body></html>