[flang-commits] [flang] dd43e13 - [flang] Fix MSVC build breakage

peter klausler via flang-commits flang-commits at lists.llvm.org
Fri Apr 2 08:28:56 PDT 2021


Author: peter klausler
Date: 2021-04-02T08:28:48-07:00
New Revision: dd43e13c005806be06bf09c735353a3d8707c8c8

URL: https://github.com/llvm/llvm-project/commit/dd43e13c005806be06bf09c735353a3d8707c8c8
DIFF: https://github.com/llvm/llvm-project/commit/dd43e13c005806be06bf09c735353a3d8707c8c8.diff

LOG: [flang] Fix MSVC build breakage

A recent patch exposed an assumption that "long double" is (at least)
an 80-bit floating-point type, which of course it is not in MSVC.
Also get it right for non-x87 floating-point.

Added: 
    

Modified: 
    flang/lib/Decimal/binary-to-decimal.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Decimal/binary-to-decimal.cpp b/flang/lib/Decimal/binary-to-decimal.cpp
index c6e5ee80b3e44..68ee345b89352 100644
--- a/flang/lib/Decimal/binary-to-decimal.cpp
+++ b/flang/lib/Decimal/binary-to-decimal.cpp
@@ -350,12 +350,21 @@ ConversionToDecimalResult ConvertDoubleToDecimal(char *buffer, std::size_t size,
       rounding, Fortran::decimal::BinaryFloatingPointNumber<53>(x));
 }
 
+#if LONG_DOUBLE == 80
 ConversionToDecimalResult ConvertLongDoubleToDecimal(char *buffer,
     std::size_t size, enum DecimalConversionFlags flags, int digits,
     enum FortranRounding rounding, long double x) {
   return Fortran::decimal::ConvertToDecimal(buffer, size, flags, digits,
       rounding, Fortran::decimal::BinaryFloatingPointNumber<64>(x));
 }
+#elif LONG_DOUBLE == 128
+ConversionToDecimalResult ConvertLongDoubleToDecimal(char *buffer,
+    std::size_t size, enum DecimalConversionFlags flags, int digits,
+    enum FortranRounding rounding, long double x) {
+  return Fortran::decimal::ConvertToDecimal(buffer, size, flags, digits,
+      rounding, Fortran::decimal::BinaryFloatingPointNumber<113>(x));
+}
+#endif
 }
 
 template <int PREC, int LOG10RADIX>


        


More information about the flang-commits mailing list