[R-pkg-devel] unexpected CRAN pretest failure

2020-12-14 Thread Rossum, Bart-Jan van
Dear community,

When trying to update my CRAN 
(https://cran.r-project.org/web/packages/statgenGxE/index.html) package in ran 
into unexpected error on Windows.
I had tested before submission on R-hub, which went fine, but CRAN complained, 
and this was confirmed on Winbuilder.
I noticed a slight difference in R-version used on CRAN/Winbuilder and R-hub.
However, the error itself seems to come from an lme4 function. 
I'm quite clueless on how to debug/fix this. 

CRAN and Winbuilder:
R Under development (unstable) (2020-12-13 r79623)
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2FnK0OMOQ378SI&data=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7C0bf8357a13b84c807ad708d8a0308e40%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637435477692513415%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HqExR7SELQ7U32H67xF3ufPKxyTZm3162ZiGb6YetI8%3D&reserved=0

R-hub:
R Under development (unstable) (2020-11-30 r79529)
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbuilder.r-hub.io%2Fstatus%2FstatgenGxE_1.0.4.tar.gz-fcc1e205a5fb4fd09559d301ee3502c9&data=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7Cce0d271db460494b5a6908d8a0248bc0%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637435426112472834%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=j2RrXotL3qz5r1O6gcfXxb1VH8WuM2UaWaYQ5SnQFz0%3D&reserved=0

Any pointers are appreciated,
Bart-Jan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2020-12-14 Thread Pierre Lafaye de Micheaux
Dear Tomas,

Apologies for the very long delay.

I was able to create a minimal version of the package (attached) that gives the 
same exact warnings:

myzhpevx.cpp:22:16: warning: type of ‘zhpevx_’ does not match original 
declaration [-Wlto-type-mismatch]
   void F77_NAME(zhpevx)(char *jobz, char *range, char *uplo,
^
zhpevx.f:232:14: note: type mismatch in parameter 20
   SUBROUTINE zhpevx(JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU,
  ^
zhpevx.f:232:14: note: type ‘long int’ should match type ‘size_t’
zhpevx.f:232:14: note: ‘zhpevx’ was previously declared here
zhpevx.f:232:14: note: code may be misoptimized unless -fno-strict-aliasing is 
used

I am under the impression that I am following quite closely what is written 
here: 
https://cran.csiro.au/doc/manuals/r-patched/R-exts.html#Fortran-character-strings

I tried many different things but I always end up with the same main warning 
(i.e., type of ‘zhpevx_’ does not match original declaration ).

My version of fortran: GNU Fortran (Debian 8.3.0-6) 8.3.0 under Debian 10.

Thank you very much for any further help you could provide so that I could have 
my package back to the CRAN.

Kind regards,
Pierre L.



From: Tomas Kalibera 
Sent: Tuesday, 7 July 2020 15:43
To: Pierre Lafaye de Micheaux 
Cc: r-package-devel@r-project.org 
Subject: Re: [R-pkg-devel] warning: type of ‘zhpevx_’ does not match original 
declaration [-Wlto-type-mismatch]

My recommendation would be to try to minimize the example (package) as much as 
possible so that it still has the problem, and then try to investigate why 
exactly/where is the type mismatch. This is what helped me debug similar issues 
- sometimes it was hard to tell from the Fortran warnings where exactly the 
mismatched declarations were and why they were mismatched.

This process of minimization can already reveal the true source of the problem, 
and if not, others may try to debug for you using the minimal example. A useful 
tool is the Fortran option -fc-prototypes-external (see WRE for more details) 
and I've also used dumps of the compiler tree before (-fdump-tree-all, more in 
GCC documentation).

Best
Tomas

On 7/7/20 5:00 AM, Pierre Lafaye de Micheaux wrote:

My file myzhpevx.cpp starts with:


#define USE_FC_LEN_T
#include 
#include "Rmath.h"

#ifdef FC_LEN_T
extern "C" {

  void zhpevxC(char **jobz, char **range, char **uplo, int *n, Rcomplex *ap,
 double *vl, double *vu, int *il, int *iu, double *abstol, int *m,
 double *w, Rcomplex *z, int *ldz, Rcomplex *work, double *rwork,
 int *iwork, int *ifail, int *info) {

  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);


So if I understand correctly what you are saying, you suggest that FC_LEN_T was 
not correctly defined by the CRAN team?

Should I just write something like (adding the middle instruction below to my 
existing code above)?:


#ifdef FC_LEN_T
typedef long long int FC_LEN_T;
extern "C" {


Thank you
Pierre

From: William Dunlap 
Sent: Tuesday, 7 July 2020 11:46
To: Pierre Lafaye de Micheaux 
Cc: Ivan Krylov ; 
r-package-devel@r-project.org 

Subject: Re: [R-pkg-devel] warning: type of �zhpevx_� does not match original 
declaration [-Wlto-type-mismatch]

With gcc 8.3.0, gfortran 8.3.0, and ld 2.33.1 from the mingw64 part of
rtools40 on Windows, if I misdefine the typedef FC_LEN_T and use the
-flto flag I get the sort of error messages that you report.

c:\tmp\fortran>cat main.c
#include 
#include 

#ifdef USE_INT
typedef int FC_LEN_T;
#endif
#ifdef USE_LONG
typedef long int FC_LEN_T;
#endif
#ifdef USE_LONG_LONG
typedef long long int FC_LEN_T;
#endif

extern void sub_(char* word, double *ret, FC_LEN_T word_len);

int main(int argc, char* argv[])
{
if (argc == 2) {
double ret = 3. ;
FC_LEN_T word_len = strlen(argv[1]);
sub_(argv[1], &ret, word_len);
printf("sizeof(FC_LEN_T)=%d, ret=%g\n", (int)(sizeof(FC_LEN_T)), ret);
return 0;
} else {
return -1;
}
}

c:\tmp\fortran>gcc  -flto -DUSE_INT main.c sub.f -lgfortran
main.c:14:13: warning: type of 'sub_' does not match original
declaration [-Wlto-type-mismatch]
 extern void sub_(char* word, double *ret, FC_LEN_T word_len);
 ^
sub.f:1:1: note: type mismatch in parameter 3
   subroutine sub(word, ret)
 ^
sub.f:1:1: note: type 'long long int' should match type 'FC_LEN_T'
sub.f:1:1: note: 'sub' was previously declared here
s