Boost C++ Libraries: Ticket #7272: win32/thread_primitives.hpp: (Unneccessary) Warning https://svn.boost.org/trac10/ticket/7272 <p> When compiling with the Intel C++ compiler 12.1, I receive an (unneccessary) warning about an uninitialised variable 'ret': </p> <p> 1&gt;thread_primitives.hpp(356): warning <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/592" title="#592: Bugs: ambiguous overloads in boost::variant source code (closed: None)">#592</a>: variable "ret" is used before its value is set 1&gt; return ret; 1&gt; <sup> 1&gt; 1&gt;thread_primitives.hpp(377): warning <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/592" title="#592: Bugs: ambiguous overloads in boost::variant source code (closed: None)">#592</a>: variable "ret" is used before its value is set 1&gt; return ret; 1&gt; </sup> </p> <p> Suggested fix: See attached file </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7272 Trac 1.4.3 christian.buss@… Fri, 24 Aug 2012 09:44:54 GMT attachment set https://svn.boost.org/trac10/ticket/7272 https://svn.boost.org/trac10/ticket/7272 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread_primitives.hpp.diff</span> </li> </ul> <p> Diff for suggested fix. </p> Ticket viboes Fri, 24 Aug 2012 22:22:13 GMT <link>https://svn.boost.org/trac10/ticket/7272#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7272#comment:1</guid> <description> <p> In order to avoid the unnecessary assignation for all the compilers I think it is better to apply it conditionally. In addition the current code causing the warning was there for Intel compiler, so the attached patch should work. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 24 Aug 2012 22:23:03 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/7272 https://svn.boost.org/trac10/ticket/7272 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">7272.patch</span> </li> </ul> Ticket viboes Fri, 24 Aug 2012 22:24:01 GMT owner, status, version changed https://svn.boost.org/trac10/ticket/7272#comment:2 https://svn.boost.org/trac10/ticket/7272#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.52.0</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> Ticket viboes Sun, 26 Aug 2012 13:02:27 GMT milestone changed https://svn.boost.org/trac10/ticket/7272#comment:3 https://svn.boost.org/trac10/ticket/7272#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> <p> Committed in trunk at <a class="changeset" href="https://svn.boost.org/trac10/changeset/80203" title="Thread: take care of #7272 warning removal">[80203]</a> </p> Ticket viboes Sun, 26 Aug 2012 13:07:01 GMT <link>https://svn.boost.org/trac10/ticket/7272#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7272#comment:4</guid> <description> <p> Committed in trunk at <a class="changeset" href="https://svn.boost.org/trac10/changeset/80235" title="Thread: take care of #7272 warning removal">[80235]</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 09 Sep 2012 13:32:02 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7272#comment:5 https://svn.boost.org/trac10/ticket/7272#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Merged to release <a class="changeset" href="https://svn.boost.org/trac10/changeset/80450" title="Thread: merge from trunk: 1.52">[80450]</a> </p> Ticket gix Fri, 28 Sep 2012 21:32:14 GMT attachment set https://svn.boost.org/trac10/ticket/7272 https://svn.boost.org/trac10/ticket/7272 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-7272.cpp</span> </li> </ul> <p> test-case </p> Ticket gix Fri, 28 Sep 2012 21:37:33 GMT status, severity changed; resolution deleted https://svn.boost.org/trac10/ticket/7272#comment:6 https://svn.boost.org/trac10/ticket/7272#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Cosmetic</span> → <span class="trac-field-new">Problem</span> </li> </ul> <p> The warning reported by ICL points at a serious bug. Changesets <a class="changeset" href="https://svn.boost.org/trac10/changeset/80203" title="Thread: take care of #7272 warning removal">[80203]</a> and <a class="changeset" href="https://svn.boost.org/trac10/changeset/80235" title="Thread: take care of #7272 warning removal">[80235]</a> only silence the warning. </p> <p> ICL seems to only accept newlines as separator between asm instructions and only emits "mov eax,bit", which makes interlocked_bit_test_and_set return an ret uninitialized. </p> <p> Running the attached test case: </p> <pre class="wiki">$ icl -nologo -EHsc boost-7272.cpp &amp;&amp; boost-7272.exe boost-7272.cpp Testing bit 0 of x=3 result: 0 (expected: 1) x: 3 (expected: 3) Testing bit 2 of x=3 result: 0 (expected: 0) x: 3 (expected: 7) </pre><p> As a comparison, here with MSVC: </p> <pre class="wiki">D:\&gt;cl -nologo -EHsc boost-7272.cpp &amp;&amp; boost-7272.exe boost-7272.cpp Testing bit 0 of x=3 result: 1 (expected: 1) x: 3 (expected: 3) Testing bit 2 of x=3 result: 0 (expected: 0) x: 7 (expected: 7) </pre><p> Putting each instruction on a separate line (with and without trailing ";") fixes this. </p> Ticket gix Fri, 28 Sep 2012 21:49:55 GMT attachment set https://svn.boost.org/trac10/ticket/7272 https://svn.boost.org/trac10/ticket/7272 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-7272-proper.patch</span> </li> </ul> <p> Proper patch, reformats asm instructions </p> Ticket viboes Sat, 29 Sep 2012 16:53:47 GMT <link>https://svn.boost.org/trac10/ticket/7272#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7272#comment:7</guid> <description> <p> Committed in trunk revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/80757" title="Thread: rollback preceding change and apply patch spliting the ...">[80757]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 09 Oct 2012 23:38:15 GMT</pubDate> <title>milestone deleted https://svn.boost.org/trac10/ticket/7272#comment:8 https://svn.boost.org/trac10/ticket/7272#comment:8 <ul> <li><strong>milestone</strong> <span class="trac-field-deleted">Boost 1.52.0</span> </li> </ul> Ticket viboes Thu, 11 Oct 2012 15:59:28 GMT status changed; resolution, milestone set https://svn.boost.org/trac10/ticket/7272#comment:9 https://svn.boost.org/trac10/ticket/7272#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> <p> Merged revision 80955. </p> Ticket