[patch, Fortran] Make REAL(KIND=16) detection more robust

FX fxcoudert@gmail.com
Sun Dec 19 23:42:13 GMT 2021


Hi Thomas,

> I am not sure the logic is correct for POWER (old style) where we have
> a 16-byte long double made up from two 8-byte doubles, which is not
> __float128 (IFmode)

As written, the patch should be a no-op for existing platforms. I know about the ppc double-double "long double" type, and I think it works. (If it is actually broken, please let me know how, I’ll improve the patch.)

If we follow the logic of mk-kinds-h.sh:

- it will loop over real kinds, and reach kind=16
- [ $long_double_kind -eq 10 ] is false, so we go to the second block
- we define the following:

>  	    ctype="long double"
>  	    cplxtype="complex long double"
>  	    suffix="l"
> +	    echo "#define GFC_REAL_16_IS_LONG_DOUBLE"


which is true.


> I have a proposal: Since I am currently trying to unravel this
> on the power-ieee128 branch, I would like to take this on,
> if that is fine with you.

I’m not opposed, but I’d really like to get this into the current branch. It is a much less invasive change than the power-ieee128 work. The only case I changed is the case where there is a kind 16, and there is a long double, but the long double is neither kind 10 neither kind 16. I don’t think there is such a platform currently (otherwise it wouldn’t have worked).

Best,
FX


More information about the Fortran mailing list