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

Shawn Way @w@y @end|ng |rom empowerph@rm@cy@com
Tue Jun 21 22:12:32 CEST 2022


Thanks!  The package I'm trying to get working is IAPWS95.  It can compile and work just fine, however, CRAN moderators are reporting the following:

Thanks, with  LTO checks enabled we still see



IAPWS95_init.c:37:13: warning: type of ‘dth_’ does not match original
declaration [-Wlto-type-mismatch]
    37 | extern void F77_NAME(dth)(double *T, double *h, double *D, int
*icode);
      |            ^
IAPWS9521D.f90:2344:31: note: return value type mismatch
  2344 |      REAL(KIND=8) function DTh( T, h, D, Dupp, icode)
      |                              ^
IAPWS9521D.f90:2344:31: note: type ‘double’ should match type ‘void’
IAPWS9521D.f90:2344:31: note: ‘dth’ was previously declared here
IAPWS9521D.f90:2344:31: note: code may be misoptimized unless
‘-fno-strict-aliasing’ is used
IAPWS95_init.c:58:13: warning: type of ‘phi0dt_’ does not match original
declaration [-Wlto-type-mismatch]
    58 | extern void F77_NAME(phi0dt)(double *D, double *fhizdT, int
*icode);
      |            ^
IAPWS9521D.f90:1250:34: note: return value type mismatch
  1250 |      REAL(KIND=8) function PHI0DT(fhizdt, icode)
      |                                  ^
IAPWS9521D.f90:1250:34: note: type ‘double’ should match type ‘void’
IAPWS9521D.f90:1250:34: note: ‘phi0dt’ was previously declared here
IAPWS9521D.f90:1250:34: note: code may be misoptimized unless
‘-fno-strict-aliasing’ is used


Please fix and resubmit.
Best,
Uwe Ligges


I'm trying to enable the LTO checks on windows and then reproduce the errors.  Once I have that, then I can try to figure out the code errors. Not that I know exactly know how to do that right now, but I need to try to fix it.

Thank you kindly!

Shawn Way

-----Original Message-----
From: Tomas Kalibera <tomas.kalibera using gmail.com> 
Sent: Tuesday, June 21, 2022 2:54 PM
To: Shawn Way <sway using empowerpharmacy.com>; r-package-devel using r-project.org
Subject: Re: [R-pkg-devel] Troubleshooting Fortran type mismatch and --enable-lto


On 6/21/22 20:38, Shawn Way wrote:
> I've gotten a response from the build team that I have a type mis-match between my fortran code and it was discovered using the -enable-lto option for compilation.  I'm trying to even be able to reproduce the error so that I can fix the error.  I've read the R Admin and the Writing R extensions and it has muddied the waters for building using a Windows machine.
>
> Can someone please give me a hint how to "enable-lto" for building R packages using R 4.2.0?  I would really love understand how to troubleshoot combined R and fortran code.
Please try following 4.5 of Writing R Extensions and if you run into problems, ask specifically, providing an exact description what you did and key parts of outputs, so that others can help.
> Just FYI, I'm taking over the package as a maintainer as the original package creator died a couple of years ago.  It's a new experience for me.

Please also give the name of the package - it may be possible to tell from the outputs what is the problem.

Best
Tomas

>
> Thank you kindly,
>
> Shawn Way
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-package-devel


More information about the R-package-devel mailing list