Skip to content
Prev 8198 / 12125 Next

[R-pkg-devel] Troubleshooting Fortran type mismatch and --enable-lto

I had to make the modifications you suggested to the .C file and it worked like a charm.  I also had to make the following changes to my ~/.R/Makevar file:

LTO_OPT=-flto -ffat-lto-objects

Doing this seems to have worked well!  Thank you very much!  I would not have been able to do this without your help.

Shawn Way

-----Original Message-----
From: Tomas Kalibera <tomas.kalibera at gmail.com> 
Sent: Tuesday, June 21, 2022 3:48 PM
To: Shawn Way <sway at empowerpharmacy.com>; r-package-devel at r-project.org
Subject: Re: [R-pkg-devel] Troubleshooting Fortran type mismatch and --enable-lto
On 6/21/22 22:12, Shawn Way wrote:
I can reproduce as described in WRE. I've modified my etc/x64/Makeconf to have LTO_OPT=-flto and then ran

R CMD INSTALL --use-LTO IAPWS95_1.1.0.tar.gz

and I got the errors as reported. Editing the C file as shown below, to match the Fortran definitions, makes the compiler happy.

Best
Tomas

diff -Nru orig/IAPWS95/src/IAPWS95_init.c patched/IAPWS95/src/IAPWS95_init.c
--- orig/IAPWS95/src/IAPWS95_init.c???? 2018-06-18 13:38:21.000000000 +0200
+++ patched/IAPWS95/src/IAPWS95_init.c? 2022-06-21 22:41:52.628001900 
+++ +0200
@@ -34,7 +34,7 @@
 ?extern void F77_NAME(dph)(double *p, double *h, double *D, int *icode);
 ?extern void F77_NAME(dps)(double *p, double *s, double *D, int *icode);
 ?extern void F77_NAME(dptctetab)(int *np, double *T, double *p, double *y); -extern void F77_NAME(dth)(double *T, double *h, double *D, int *icode);
+extern double F77_NAME(dth)(double *T, double *h, double *D, double
*Dupp, int *icode);
 ?extern void F77_NAME(dtp)(double *T, double *p, double *D, int *icode);
 ?extern void F77_NAME(dtpctetab)(int *nT, double *p, double *T, double *y);
 ?extern void F77_NAME(dts)(double *T, double *s, double *D, int *icode); @@ -55,7 +55,7 @@
 ?extern void F77_NAME(kvisctd)(double *T, double *D, double *KVscty, int *icode);
 ?extern void F77_NAME(phi0dd)(double *D, double *fhizd, int *icode);
 ?extern void F77_NAME(phi0ddd)(double *D, double *fhizd, int *icode); -extern void F77_NAME(phi0dt)(double *D, double *fhizdT, int *icode);
+extern double F77_NAME(phi0dt)(double *fhizdT, int *icode);
 ?extern void F77_NAME(phi0td)(double *T, double *D, double *fhiztd, int *icode);
 ?extern void F77_NAME(phi0ttd)(double *T, double *D, double *fhizttd, int *icode);
 ?extern void F77_NAME(phi0tttd)(double *T, double *D, double *fhiztttd, int *icode);