[PATCH] gfortran -- Map REAL128 to REAL kind type with widest precision
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Feb 8 16:56:00 GMT 2017
On Wed, Feb 08, 2017 at 10:25:22AM +0100, FX wrote:
> Hi Steve,
>
> I see Mikael has okayed the patch, but I did not have any
> time to comment prior. I wanted to note that:
>
> - the choice was deliberate, as the standard allows us to
> choose which real kind REAL128 corresponds to when there are
> several matching choices. The idea behind the current choice
> was to avoid forcing the use of slower soft-float arithmetic
> when a hardware type existed. I donât have a strong opinion
> myself on the issue.
Yes, I considered that REAL128 would now be a software implementation.
However, as an individual who works on FreeBSD, I found it rather
unpleasing for i686-*-freebsd to map REAL128 to REAL(16) and
x86_64-*-freebsd to map it to REAL(10). I also considered that
some (many?, most?) users who don't look under the hood may
expect REAL128 to map to a IEEE754 128-bit floating point entity
where it has 113 bits of precision.
> - This is a breakage of the ABI, so we want to write it in the
> release notes, and in the doc about ISO_FORTRAN_ENV.
The 6.3 manual has
REAL32, REAL64, REAL128: Kind type parameters to specify a REAL
type with a storage size of 32, 64, and 128 bits. It is negative
if a target platform does not support the particular kind.
(Fortran 2008 or later.)
My patch does not change the above.
I'll also note that with my patch REAL128 does not change with
-m96bit-long-double, -mlong-double-64, or -mlong-double-80. So,
the ABI is now stable. On my x86_64-*-freebsd system, gfortran6
does not include my unpatched and gfc7 is patches.
% cat a.f90
program foo
use iso_fortran_env
REAL(REAL128) x
print '(3(I0,1X))', kind(x), digits(x), precision(x)
end program foo
% gfortran6 -static -o z a.f90 && ./z
10 64 18
% gfortran6 -static -o z a.f90 -m96bit-long-double && ./z
16 113 33
% gfc7 -static -o z a.f90 && ./z
16 113 33
% gfc7 -static -o z a.f90 -m96bit-long-double && ./z
16 113 33
> - Is this appropriate for stage 4?
I think it is appropriate as we already broke libgfortran
for 7.0. I'll revert the patch as I can always maintain a
local patches.
--
Steve
20161221 https://www.youtube.com/watch?v=IbCHE-hONow
More information about the Fortran
mailing list