Boost C++ Libraries: Ticket #8568: Infinite loop in hash_value_signed/hash_value_unsigned https://svn.boost.org/trac10/ticket/8568 <p> Visual C++ 2012 static analysis found these two infinite loop warnings in hash.hpp: </p> <pre class="wiki">for(unsigned int i = length * size_t_bits; i &gt; 0; i -= size_t_bits) { seed ^= (std::size_t) (positive &gt;&gt; i) + (seed&lt;&lt;6) + (seed&gt;&gt;2); } </pre><p> Warning message: </p> <pre class="wiki">hash.hpp(156): warning : C6295: Ill-defined for-loop: 'unsigned int' values are always of range '0' to '4294967295'. Loop executes infinitely. hash.hpp(176): warning : C6295: Ill-defined for-loop: 'unsigned int' values are always of range '0' to '4294967295'. Loop executes infinitely. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8568 Trac 1.4.3 Bikineev Anton <abikineev@…> Mon, 24 Jun 2013 16:55:48 GMT attachment set https://svn.boost.org/trac10/ticket/8568 https://svn.boost.org/trac10/ticket/8568 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">loop_warning.patch</span> </li> </ul> <p> pragma warning disable for msvc is added </p> Ticket anonymous Mon, 29 Jul 2013 11:41:16 GMT owner, component changed https://svn.boost.org/trac10/ticket/8568#comment:1 https://svn.boost.org/trac10/ticket/8568#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Daniel James</span> </li> <li><strong>component</strong> <span class="trac-field-old">functional</span> → <span class="trac-field-new">hash</span> </li> </ul> Ticket Daniel James Thu, 08 Aug 2013 22:01:19 GMT <link>https://svn.boost.org/trac10/ticket/8568#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8568#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85248" title="Fix Visual C++ warning in hash. Refs #8568. I changed this a little ...">[85248]</a>) Fix Visual C++ warning in hash. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8568" title="#8568: Bugs: Infinite loop in hash_value_signed/hash_value_unsigned (closed: fixed)">#8568</a>. </p> <p> I changed this a little from the patch on <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8568" title="#8568: Bugs: Infinite loop in hash_value_signed/hash_value_unsigned (closed: fixed)">#8568</a>. I moved the pragmas to the start and end of the file because I don't like to little the body of the code with them (this does mean I've disabled a potentially useful warning, but the code is pretty stable nowadays). </p> <p> I also removed the version checks, as the warning should be present in later versions. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Sun, 18 Aug 2013 09:48:55 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8568#comment:3 https://svn.boost.org/trac10/ticket/8568#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85389" title="Merge Hash. Fixes #8568, Refs #8822.#8822.#8822. ">[85389]</a>) Merge Hash. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8568" title="#8568: Bugs: Infinite loop in hash_value_signed/hash_value_unsigned (closed: fixed)">#8568</a>, Refs <a class="new ticket" href="https://svn.boost.org/trac10/ticket/8822" title="#8822: Bugs: issues compiling regex on SunOS 5.9 sparc (new)">#8822</a>.<a class="new ticket" href="https://svn.boost.org/trac10/ticket/8822" title="#8822: Bugs: issues compiling regex on SunOS 5.9 sparc (new)">#8822</a>.<a class="new ticket" href="https://svn.boost.org/trac10/ticket/8822" title="#8822: Bugs: issues compiling regex on SunOS 5.9 sparc (new)">#8822</a>. </p> Ticket qiaozhiqiang@… Wed, 09 Oct 2013 01:58:58 GMT <link>https://svn.boost.org/trac10/ticket/8568#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8568#comment:4</guid> <description> <p> unsigned int i, so i &gt;= 0, so i &gt; 0 is i != 0 </p> <p> we should change i &gt; 0 to i != 0 to avoid warning. </p> </description> <category>Ticket</category> </item> </channel> </rss>