<html><body><p>Hans,<br><br>this is one more patch that should go into 3.8 -- it fixes miscompiles of code using GCC-provided C++11 system headers like <thread>.<br><br>With this patch, the test suite is now clean also with a bootstrapped clang.<br><br><tt><font size="4">>Author: uweigand<br>>Date: Fri Feb 5 15:34:28 2016<br>>New Revision: 259931<br>><br>>URL: </font></tt><a href="http://llvm.org/viewvc/llvm-project?rev=259931&view=rev"><tt><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project?rev=259931&view=rev</font></u></tt></a><tt><font size="4"><br>>Log: [SystemZ] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros<br>><br>>Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_[1248] macros on SystemZ.<br>><br>>This fixes a miscompile of GCC C++11 standard library headers<br>>due to use of those macros in an ABI-changing manner.<br>><br>>See e.g. /usr/include/c++/4.8.5/ext/concurrence.h:<br>><br>> // Compile time constant that indicates prefered locking policy in<br>> // the current configuration.<br>> static const _Lock_policy __default_lock_policy =<br>>#ifdef __GTHREADS<br>>#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \<br>> && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4))<br>> _S_atomic;<br>>#else<br>> _S_mutex;<br>>#endif<br>>#else<br>> _S_single;<br>>#endif<br>><br>>A different choice of __default_lock_policy causes different<br>>sizes of several of the C++11 data structures, which are then<br>>incompatible when inlined in clang-compiled code with what the<br>>(GCC-compiled) external library expects.<br>><br>>This in turn leads to various crashes when using std::thread<br>>in code compiled with clang, as see e.g. via the ThreadPool<br>>unit tests. See PR 26473 for an example.<br>><br>><br>>Modified:<br>> cfe/trunk/lib/Basic/Targets.cpp<br>> cfe/trunk/test/Preprocessor/predefined-arch-macros.c</font></tt><br><br><br>Mit freundlichen Gruessen / Best Regards<br><br>Ulrich Weigand<br><br>-- <br> Dr. Ulrich Weigand | Phone: +49-7031/16-3727<br> STSM, GNU/Linux compilers and toolchain<br> IBM Deutschland Research & Development GmbH<br> Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk Wittkopp<br> Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294<BR>
</body></html>