Page MenuHomePhabricator

[flang][msvc] long double is not different from double.
AbandonedPublic

Authored by Meinersbur on Sep 29 2020, 12:59 PM.

Details

Summary

In Microsoft's 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.

Diff Detail

Event Timeline

Meinersbur created this revision.Sep 29 2020, 12:59 PM
Herald added a project: Restricted Project. · View Herald Transcript
Meinersbur requested review of this revision.Sep 29 2020, 12:59 PM

Is there no access to 80-bit extended precision at all in MSVC?

Input and output conversion never actually has to do any floating-point arithmetic, so it would be possible to treat the 80-bit extended precision (and 128-bit quad precision) types in I/O as struct around a char[10 or 16] array instead of simply disallowing their use in I/O, which seems unfair since we support them in computation.

Microsoft removed support for 80-bit floating points during the transition from 16 to 32 bit, so quite some time ago.

Formatting of extended and quadruple precision is already dependent on host compiler support. As you mentioned, the only reason for it seems to be to have a type of the required length. However, I am not going to rewrite flang's IO runtime now.

DavidTruby resigned from this revision.Sep 30 2020, 4:14 AM
Meinersbur retitled this revision from [flang][msvc] double is same as long double under Windows AMD64 ABI. to [flang][msvc] long double is not different from double..
Meinersbur edited the summary of this revision. (Show Details)
  • long double == double is generally true with msvc, not just with AMD64.

See D88752, which avoids the needless usage of the native floating types.

Meinersbur abandoned this revision.Oct 12 2020, 1:36 PM

Abandon in favor of D88752