[R-pkg-devel] Modernizing legacy Fortran:, REAL(kind=8)

Thomas Petzoldt thom@@@petzo|dt @end|ng |rom tu-dre@den@de
Thu Aug 31 11:41:55 CEST 2023


On 30.08.2023 at 11:58 Ivan Krylov wrote:
> On Wed, 30 Aug 2023 08:43:04 +0200
> Thomas Petzoldt <thomas.petzoldt using tu-dresden.de> wrote:
> 
>> a) change REAL(kind=8) back to DOUBLE PRECISION that is again old
>> style. It seems to be portable and is still widely used.
> 
> I don't have a reference as good as the Fortran standard, but Steve
> Lionel said in Dr. Fortran [*] that DOUBLE PRECISION is still part of
> the standard fixed-form syntax.
> 
>>   COMPLEX(KIND=8)
> 
> This could be particularly problematic if you're trying to interoperate
> with C, but will probably not surface unless you use LTO:
> https://bugs.r-project.org/show_bug.cgi?id=18430
> 
> Unfortunately, there's no standard DOUBLE COMPLEX.
> 

Thank you, this helps. I had a look in Dr. Fortran myself and some other 
sites, but especially the COMPLEX definitions remain unclear.

I tried now the following, because the included original Fortran codes 
follow slightly different standards:

- replace COMPLEX(KIND=8) with DOUBLE COMPLEX in source files that use 
DOUBLE PRECISION otherwise

- replace real(kind=8) with real(kind=kind(0.0d0)) in the more modern 
source files

This is pragmatic and may not be the best way, but looks mostly 
consistent. Now I checked the package and everything was ok, but I was 
not able reproduce the warnings from the previous version.

I assume that I have to set an environment variable to see the warnings, 
but which one?

I use gfortran/gcc 13.2.1-1 on Fedora 38.

Thanks!

Thomas

-- 
https://tu-dresden.de/Members/thomas.petzoldt


More information about the R-package-devel mailing list