Boost C++ Libraries: Ticket #3436: Code miscompilation with MSVC 7.1 https://svn.boost.org/trac10/ticket/3436 <p> While trying to compile Boost.Test 1.40 with MSVC 7.1 into a shared library I found out that the library crashed during initialization. </p> <p> Apparently, the crash was because of the broken code compilation in the library. The problem is that the typed_parameter&lt; ... &gt;::accept_modifier method is called on invalid this pointer. It looks like MSVC 7.1 has a hard time in compiling operator&lt;&lt; and operator- when it accepts shared_ptr by value. When I changed the operators to accept const references everything worked fine. </p> <p> Please find the patch attached. It may also be useful to speed up test startup, aside for the MSVC 7.1 cure. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3436 Trac 1.4.3 Andrey Semashev Fri, 11 Sep 2009 16:03:09 GMT attachment set https://svn.boost.org/trac10/ticket/3436 https://svn.boost.org/trac10/ticket/3436 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">cla.patch</span> </li> </ul> <p> The fix for code miscompilation on MSVC 7.1 </p> Ticket Gennadiy Rozental Sun, 22 Nov 2009 22:38:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3436#comment:1 https://svn.boost.org/trac10/ticket/3436#comment:1 <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">worksforme</span> </li> </ul> <p> Works fine for me. In fact I believe shared library build is part of routine regression tests. </p> <p> Are you sure it's not something specific to your setup? Do you have an example which reproduces this? </p> <p> Also what to you mean by speedup startup? How long does it take for you? </p> Ticket Andrey Semashev Mon, 23 Nov 2009 06:45:49 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/3436#comment:2 https://svn.boost.org/trac10/ticket/3436#comment:2 <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">worksforme</span> </li> </ul> <blockquote class="citation"> <p> Works fine for me. In fact I believe shared library build is part of routine regression tests. </p> </blockquote> <p> I'm not sure Boost.Test is build as a shared library with my options in the regular testing process. </p> <blockquote class="citation"> <p> Are you sure it's not something specific to your setup? Do you have an example which reproduces this? </p> </blockquote> <p> I have described my setup in ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3435" title="#3435: Bugs: Linking failure with MSVC 7.1 (closed: wontfix)">#3435</a>. I still have problems with 1.41 Boost release (after the patch from <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3435" title="#3435: Bugs: Linking failure with MSVC 7.1 (closed: wontfix)">#3435</a> is applied), although the test now simply ends with the "Boost.Test framework internal error: unknown reason" message instead of a crash. I don't have much time to dig deeper now, but I suspect that the root of the problem is still the same. </p> <p> Here is my test case: </p> <pre class="wiki">#define BOOST_ALL_DYN_LINK #define BOOST_TEST_MAIN #include &lt;boost/test/unit_test.hpp&gt; #include &lt;boost/test/test_tools.hpp&gt; #include &lt;boost/test/unit_test_suite.hpp&gt; BOOST_AUTO_TEST_CASE(MyTest) { BOOST_CHECK(true); } </pre><p> I compile it with the following commad line: </p> <pre class="wiki">cl -Ox -I ../STLport/stlport -I . -EHsc -MD ./test.cpp </pre><p> Where . is in the boost 1.41 directory. However, I believe, pretty much any test case is affected. </p> <blockquote class="citation"> <p> Also what to you mean by speedup startup? How long does it take for you? </p> </blockquote> <p> It's not something I measured or intentionally wanted to speedup. It was just a side effect of the proposed patch. We have several thousands of tests here, many of them are using Boost.Test. If each particular test starts a bit faster, it has an observable effect on our testing as a whole. But since without the patch none of the tests work, I don't have anything to compare with. </p> Ticket Gennadiy Rozental Sat, 28 Nov 2009 09:51:25 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3436#comment:3 https://svn.boost.org/trac10/ticket/3436#comment:3 <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">worksforme</span> </li> </ul> <ol><li>Shared library is default build with bjam, thus unless one intentionally change it shared library is being used. </li></ol><ol start="2"><li>Please check my comments ot <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3435" title="#3435: Bugs: Linking failure with MSVC 7.1 (closed: wontfix)">#3435</a>. I am pretty sure here is something similar, cause I can't reproduce it in my setup. If you still see the issue, please resubmit with and example and all the details about how you build both test module and test library </li></ol><p> P.S. You only need 1 include: #include &lt;boost/test/unit_test.hpp&gt; </p> Ticket