r259931 - [SystemZ] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
Ulrich Weigand via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 5 14:06:13 PST 2016
Hans,
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>.
With this patch, the test suite is now clean also with a bootstrapped
clang.
>Author: uweigand
>Date: Fri Feb 5 15:34:28 2016
>New Revision: 259931
>
>URL: http://llvm.org/viewvc/llvm-project?rev=259931&view=rev
>Log: [SystemZ] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
>
>Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_[1248] macros on SystemZ.
>
>This fixes a miscompile of GCC C++11 standard library headers
>due to use of those macros in an ABI-changing manner.
>
>See e.g. /usr/include/c++/4.8.5/ext/concurrence.h:
>
> // Compile time constant that indicates prefered locking policy in
> // the current configuration.
> static const _Lock_policy __default_lock_policy =
>#ifdef __GTHREADS
>#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \
> && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4))
> _S_atomic;
>#else
> _S_mutex;
>#endif
>#else
> _S_single;
>#endif
>
>A different choice of __default_lock_policy causes different
>sizes of several of the C++11 data structures, which are then
>incompatible when inlined in clang-compiled code with what the
>(GCC-compiled) external library expects.
>
>This in turn leads to various crashes when using std::thread
>in code compiled with clang, as see e.g. via the ThreadPool
>unit tests. See PR 26473 for an example.
>
>
>Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/Preprocessor/predefined-arch-macros.c
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand | Phone: +49-7031/16-3727
STSM, GNU/Linux compilers and toolchain
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
Wittkopp
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160205/667c92cd/attachment.html>
More information about the cfe-commits
mailing list