commit a2488f04d7f03ba792f508a2a3aeb2fa56311221
Author: Masamichi Hosoda <trueroad@trueroad.jp>
Date:   Tue Feb 4 23:30:29 2020 +0900

    Issue 5725/2: Add workaround for avoiding GUB darwin-x86 error
    
    In GUB, g++ 4.9.4 for darwin-x86 (macOS x86),
    it seems that static cast from  `unsigned long long` to `double`
    by x86 SSE2 raises an internal compile error.
    However, static cast from `signed long long` to `double`
    does not raise the error.
    So we use it for a workaround.
    
    i.e.
    First, static cast from `unsigned long long` to `signed long long`.
    Then, static cast from `singed long long` to `double`.

diff --git a/flower/rational.cc b/flower/rational.cc
index 559e164..fcc8017 100644
--- a/flower/rational.cc
+++ b/flower/rational.cc
@@ -31,7 +31,22 @@ double
 Rational::to_double () const
 {
   if (sign_ == -1 || sign_ == 1 || sign_ == 0)
+// FIXME: workaround: In GUB, g++ 4.9.4 for darwin-x86,
+// it seems that static cast from `unsigned long long` to `double`
+// by x86 SSE2 raises an internal compile error.
+// However, static cast from `signed long long` to `double`
+// does not raise the error.
+// So we use it for a workaround.
+#if defined (__i386__) && defined (__SSE2_MATH__) && __GNUC__ < 5
+    {
+      I64 inum = num_;
+      I64 iden = den_;
+      return static_cast<double> (sign_) *
+        static_cast<double> (inum) / static_cast<double> (iden);
+    }
+#else
     return (double)sign_ * (double)num_ / (double)den_;
+#endif
   if (sign_ == -2)
     return -HUGE_VAL;
   else if (sign_ == 2)
