[Boost-bugs] [Boost C++ Libraries] #6325: InterlockedExchangeAdd improperly identified as managed code.

Subject: [Boost-bugs] [Boost C++ Libraries] #6325: InterlockedExchangeAdd improperly identified as managed code.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-27 21:44:58


#6325: InterlockedExchangeAdd improperly identified as managed code.
--------------------------------------+-------------------------------------
 Reporter: filmorependrgn@… | Owner: chris_kohlhoff
     Type: Support Requests | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: InterlockedExchangeAdd |
--------------------------------------+-------------------------------------
 There is a Microsoft C++ bug that causes InterlockedExchangeAdd to
 improperly be identified as managed code instead of native code. A
 workaround is mentioned here:
 http://connect.microsoft.com/VisualStudio/feedback/details/629931
 /internal-compiler-error-c1001-when-compiling-
 opencv-2-1-2-2-with-c-cli-64-bit

 This prevents programs from being compiled correctly in VS2010

 The workaround is implemented below:

 boost\asio\detail\win_thread.hpp:45

 {{{
 return (1?::InterlockedExchangeAdd(&terminate_threads_, 0) != 0: 0!=
 InterlockedExchangeAdd64((volatile LONG64 *)0,(LONG64) 0));

 }}}

 and

 boost\asio\detail\impl\winsock_init.ipp:54
 {{{
 long result = (1?::InterlockedExchangeAdd(&d.result_, 0) :
 InterlockedExchangeAdd64((volatile LONG64 *)0,(LONG64) 0));
 }}}

 Implementing the above fix allows the programs to compile with a warning:
 {{{
 warning C4793:
 'boost::asio::detail::win_thread_base<boost::asio::detail::win_thread>::terminate_threads'
 : function compiled as native :
 1> Found an intrinsic not supported in managed code
 }}}

 and

 {{{
 warning C4793: 'boost::asio::detail::winsock_init_base::throw_on_error' :
 function compiled as native :
 1> Found an intrinsic not supported in managed code
 }}}


 This is a workaround for a compiler bug, so I don't know how the boost
 development team wants to treat this.

 Using VS2010 compiling for a 64-bit target (amd64)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6325>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC