[R-pkg-devel] warning: type of ‘zhpevx_’ does not match original declaration [-Wlto-type-mismatch]

Pierre Lafaye de Micheaux |@|@ye @end|ng |rom un@w@edu@@u
Fri Jul 3 02:15:27 CEST 2020


Dear all,

The problem:
I struggle to solve a WARNING that is shown on the CRAN system but not on my side when I use "R-devel check --as-cran IndependenceTests". This seems to be related to the declaration of a LAPACK Fortran subroutine (zhpevx) that I call from C.

I could not find any hint on Google allowing me to solve the issue. I read the following sections of the "Writing R Extensions" manual (but could not understand how to solve the problem):

  *   4.5 Using Link Time Optimization
  *   6.6 Calling C from Fortran and vice versa

Maybe the solution is obvious, but not to me.

The warning shown on CRAN is:
checking whether package �IndependenceTests� can be installed ...
[11s/11s] WARNING
Found the following significant warnings:
    myzhpevx.cpp:13:23: warning: type of �zhpevx_� does not match original declaration [-Wlto-type-mismatch]

Other feedback I received from the CRAN team:
Professor Brian Ripley suggested the two pieces of advice below (which I believe to have followed):

  *   For registering/interfacing Fortran calls,
       gfortran -c -fc-prototypes-external
is the best way to extract a prototype (with gfortran >= 9.2).  If this
includes int_least32_t, see the comment below on Fortran-LOGICAL.
hint).
  *
 Fortran subroutines correspond to C void functions

What is the current state of my source code:
I have a Fortran subroutine (defined in the file src/zhpevx.f at line 232):
      SUBROUTINE zhpevx( JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU,
     $     abstol, m, w, z, ldz, work, rwork, iwork,
     $     ifail, info )

This subroutine is declared (in file myzhpevx.cpp at line 13) as follows:
          void F77_NAME(zhpevx)(char *jobz, char *range, char *uplo,
      const int *n, Rcomplex *ap, const double *vl,
      const double *vu, const int *il, const int *iu,
      const double *abstol, int *m, double *w,
      Rcomplex *z, const int *ldz, Rcomplex *work, double *rwork,
      int *iwork, int *ifail, int *info,
      FC_LEN_T jobz_len,  FC_LEN_T range_len,  FC_LEN_T uplo_len);

Source package can be downloaded here:
http://biostatisticien.eu/IndependenceTests_0.5.tar.gz

My system:
Linux Debian 10 Buster
Last version of R-devel

Many thanks in advance for your help.

Best regards,

Pierre Lafaye de Micheaux

Associate Professor UNSW Sydney
Co-op Academic Coordinator for Data Science & Decisions and Advanced Maths

Tel.: (00.[+612]) 9385 7029                                      School of Mathematics and Statistics
http://web.maths.unsw.edu.au/~lafaye/            UNSW Sydney, NSW 2052, AUSTRALIA

Beginning of all science is the surprise that things are what they are (Aristotle). C'est par l'exemple et la coh�rence qu'on arrive � convaincre (P. Rabhi).

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list