Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Rebase mpfr patch on upstream commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwifb committed May 19, 2017
1 parent 67fa2fa commit fd29778
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions build/pkgs/mpfr/patches/clang_workaround.patch
@@ -1,18 +1,20 @@
diff --git a/src/set_d.c b/src/set_d.c
index c076ccf..709cbe2 100644
index c076ccf..5fc9548 100644
--- a/src/set_d.c
+++ b/src/set_d.c
@@ -118,7 +118,13 @@ __gmpfr_extract_double (mpfr_limb_ptr rp, double d)
@@ -118,8 +118,15 @@ __gmpfr_extract_double (mpfr_limb_ptr rp, double d)

d *= MP_BASE_AS_DOUBLE;
#if GMP_NUMB_BITS >= 64
+#ifdef __clang__
+ /* Work around for clang see: */
+ /* https://bugs.llvm.org//show_bug.cgi?id=8100 */
+ manl = 0x8000000000000000 + (mp_limb_t) (d - 9223372036854775808.0);
+#else /* __clang__ */
+#ifndef __clang__
manl = d;
+#endif /* __clang__ */
#else
+ /* clang produces an invalid exception when d >= 2^63,
+ see https://bugs.llvm.org//show_bug.cgi?id=17686.
+ Since this is always the case, here, we use the following patch. */
+ manl = 0x8000000000000000 + (mp_limb_t) (d - 0x8000000000000000);
+#endif /* __clang__ */
+#else
manh = (mp_limb_t) d;
manl = (mp_limb_t) ((d - manh) * MP_BASE_AS_DOUBLE);
#endif

0 comments on commit fd29778

Please sign in to comment.