[Boost-bugs] [Boost C++ Libraries] #13569: Broken build on newer versions of LLVM

Subject: [Boost-bugs] [Boost C++ Libraries] #13569: Broken build on newer versions of LLVM
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-05-18 21:45:49


#13569: Broken build on newer versions of LLVM
---------------------------------------+--------------------------
 Reporter: Emil Gilliam <egilliam@…> | Owner: timblechmann
     Type: Patches | Status: new
Milestone: To Be Determined | Component: atomic
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: |
---------------------------------------+--------------------------
 Starting with LLVM r331746, the use of compare-and-swap on a const object
 is not allowed. On x86 and Clang, this breaks several places in
 atomic/detail/ops_gcc_x86_dcas.hpp, like this:

 {{{
 if defined(__clang__)
             // Clang cannot allocate eax:edx register pairs but it has
 sync intrinsics
             value = __sync_val_compare_and_swap(&storage, (storage_type)0,
 (storage_type)0);
 #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
 ...
 }}}

 The use of compare-and-swap is actually a workaround for a Clang
 limitation which hasn't existed for a long time. Clang versions newer than
 4.0.1 understand "=&A" contraints. I am attaching a proposed patch to
 ops_css_x86_dcas.hpp and config.hpp which detects the Clang version (using
 a __has_feature), and if it's new enough, uses the "=&A" constraint,
 otherwise falls back to the existing compare-and-swap. (I had to do a bit
 of fancy footwork with the #ifs to make this happen.)

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13569>
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 : 2018-05-18 21:50:29 UTC