diff --git a/flang/lib/Evaluate/real.cpp b/flang/lib/Evaluate/real.cpp
--- a/flang/lib/Evaluate/real.cpp
+++ b/flang/lib/Evaluate/real.cpp
@@ -496,14 +496,25 @@
     }
   } else {
     using B = decimal::BinaryFloatingPointNumber
;
-    const auto *value{reinterpret_cast(this)};
+    constexpr static const auto bits{word_.bits};
+    typename B::RawType b = word_.ToUInt64();
+    if constexpr (bits > 64) {
+      auto d{word_};
+      for (int i{64}; i < bits; i += 64) {
+        d = d.SHIFTR(64);
+        const typename B::RawType l{d.ToUInt64()};
+        b |= (l << i);
+      }
+    }
+    B value{b};
+
     char buffer[24000]; // accommodate real*16
     decimal::DecimalConversionFlags flags{}; // default: exact representation
     if (minimal) {
       flags = decimal::Minimize;
     }
     auto result{decimal::ConvertToDecimal(buffer, sizeof buffer, flags,
-        static_cast(sizeof buffer), decimal::RoundNearest, *value)};
+        static_cast(sizeof buffer), decimal::RoundNearest, value)};
     const char *p{result.str};
     if (DEREF(p) == '-' || *p == '+') {
       o << *p++;