Boost C++ Libraries: Ticket #11832: clang-cl + boost intrusive = miscompile https://svn.boost.org/trac10/ticket/11832 <p> I'm not sure what the problem source is, but boost intrusive examples fail when compiled with clang-cl (but pass with clang targetting mingw). </p> <p> Attached is a reduced example doc_how_to_use.cpp and a batch file running it under clang(mingw), cl, clang-cl. The two reported address should be the identical per the original example which compares them. Yet, clang-cl (last) prints different addresses: </p> <pre class="wiki">clang++ (i686,mingw) values=0x3519d0 memberlist = 0x3519d0 cl doc_how_to_use.cpp values=003D96D0 memberlist = 003D96D0 clang-cl values=005196D0 memberlist = 005196D1 </pre><p> clang version 3.8.0 (trunk 253440). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11832 Trac 1.4.3 Yaron Keren <yaron.keren@…> Mon, 07 Dec 2015 08:20:53 GMT attachment set https://svn.boost.org/trac10/ticket/11832 https://svn.boost.org/trac10/ticket/11832 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">doc.bat</span> </li> </ul> Ticket Yaron Keren <yaron.keren@…> Mon, 07 Dec 2015 08:20:57 GMT attachment set https://svn.boost.org/trac10/ticket/11832 https://svn.boost.org/trac10/ticket/11832 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">doc.2.bat</span> </li> </ul> Ticket Yaron Keren <yaron.keren@…> Mon, 07 Dec 2015 08:21:13 GMT attachment set https://svn.boost.org/trac10/ticket/11832 https://svn.boost.org/trac10/ticket/11832 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">doc_how_to_use.cpp</span> </li> </ul> Ticket Yaron Keren <yaron.keren@…> Tue, 08 Dec 2015 22:38:02 GMT <link>https://svn.boost.org/trac10/ticket/11832#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11832#comment:1</guid> <description> <p> Reid Kleckner diagnosed the problem in <a class="ext-link" href="https://llvm.org/bugs/show_bug.cgi?id=25761"><span class="icon">​</span>https://llvm.org/bugs/show_bug.cgi?id=25761</a>: </p> <p> In boost/intrusive/detail/parent_from_member.hpp, the implementation of offset_from_pointer_to_member goes down the #idefs to the #else case, which subtracts one from the offset to create the off-by-one pointer. BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER should be defined for clang-cl. </p> <p> This could be fixed by modifying parent_from_member.hpp:26 from: </p> <pre class="wiki">#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) &amp;&amp; defined(BOOST_INTEL)) </pre><p> to: </p> <pre class="wiki">#if defined(_MSC_VER) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) &amp;&amp; defined(BOOST_INTEL)) </pre><p> since BOOST_MSVC is defined only for Visual C++ while _MSC_VER is defined for both Visual C++ and clang-cl. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 26 Feb 2016 19:50:11 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11832#comment:2 https://svn.boost.org/trac10/ticket/11832#comment:2 <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> Many thanks for the report and the solution. Fixed in: </p> <p> <a class="ext-link" href="https://github.com/boostorg/intrusive/commit/72976d34f6694ad6a7f29aa39d3128f98d8ddd42"><span class="icon">​</span>https://github.com/boostorg/intrusive/commit/72976d34f6694ad6a7f29aa39d3128f98d8ddd42</a> </p> Ticket