[libcxx-commits] [libcxx] r357478 - Special case some duration arithmetic for GCC and PPC because their long double constant folding is broken. Fixes PR#39696.

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 2 07:46:36 PDT 2019


Author: marshall
Date: Tue Apr  2 07:46:36 2019
New Revision: 357478

URL: http://llvm.org/viewvc/llvm-project?rev=357478&view=rev
Log:
Special case some duration arithmetic for GCC and PPC because their long double constant folding is broken. Fixes PR#39696.

Modified:
    libcxx/trunk/include/thread

Modified: libcxx/trunk/include/thread
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=357478&r1=357477&r2=357478&view=diff
==============================================================================
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Tue Apr  2 07:46:36 2019
@@ -434,7 +434,12 @@ sleep_for(const chrono::duration<_Rep, _
     using namespace chrono;
     if (__d > duration<_Rep, _Period>::zero())
     {
+#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
+    //  GCC's long double const folding is incomplete for IBM128 long doubles.
+        _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
+#else
         _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+#endif
         nanoseconds __ns;
         if (__d < _Max)
         {




More information about the libcxx-commits mailing list