[flang-commits] [PATCH] D88511: [flang][msvc] double is same as long double under Windows AMD64 ABI.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Sep 29 12:59:37 PDT 2020


Meinersbur created this revision.
Meinersbur added reviewers: isuruf, DavidTruby, sscalpone, klausler, tskeith.
Meinersbur added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Meinersbur requested review of this revision.

In Microsoft's AMD64 ABI `long double` is an alias for `double`, which is allowed by the C++ ABI. Therefore it is also caught by the switch case for KIND(8). Therefore the kinds 10 and 16 are not implemented for this ABI.

The error from msvc was:

  binary-floating-point.h(55): error C2607: static assertion failed
  edit-output.h(68): note: see reference to function template instantiation 'Fortran::decimal::BinaryFloatingPointNumber<113>::BinaryFloatingPointNumber<A>(A)' being compiled
          with
          [
              A=long double
          ]

This patch is part of the series to make flang compilable with MS Visual Studio http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88511

Files:
  flang/runtime/descriptor-io.h


Index: flang/runtime/descriptor-io.h
===================================================================
--- flang/runtime/descriptor-io.h
+++ flang/runtime/descriptor-io.h
@@ -279,7 +279,10 @@
         return FormattedRealIO<24, float, DIR>(io, descriptor);
       case 8:
         return FormattedRealIO<53, double, DIR>(io, descriptor);
-#if __x86_64__
+#if _M_AMD64
+        // long double is the same as double with the Microsoft compiler.
+        // Treat as unimplemented.
+#elif __x86_64__
       case 10:
         return FormattedRealIO<64, long double, DIR>(io, descriptor);
 #else
@@ -298,7 +301,10 @@
         return FormattedComplexIO<24, float, DIR>(io, descriptor);
       case 8:
         return FormattedComplexIO<53, double, DIR>(io, descriptor);
-#if __x86_64__
+#if _M_AMD64
+        // long double is the same as double with the Microsoft compiler.
+        // Treat as unimplemented.
+#elif __x86_64__
       case 10:
         return FormattedComplexIO<64, long double, DIR>(io, descriptor);
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88511.295088.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200929/72d68b5f/attachment.bin>


More information about the flang-commits mailing list