[R-pkg-devel] Warnings related to functions from the survival package
Tomas Kalibera
tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Oct 31 17:59:01 CET 2024
On 10/31/24 17:39, Ivan Krylov via R-package-devel wrote:
> В Thu, 31 Oct 2024 12:06:25 -0400
> Kaifeng Lu <kaifenglu using gmail.com> пишет:
>
>> /home/hornik/src/R/src/main/dotcode.c:1978:2: runtime error: call to
>> function coxph_wtest through pointer to incorrect function type 'void
>> (*)(void *, void *, void *, void *, void *, void *)'
>> /home/hornik/src/R/src/main/dotcode.c:1994:2: runtime error: call to
>> function agsurv5 through pointer to incorrect function type 'void
>> (*)(void *, void *, void *, void *, void *, void *, void *, void *,
>> void *, void *)' /home/hornik/src/R/src/main/dotcode.c:2008:2:
>> runtime error: call to function survdiff2 through pointer to
>> incorrect function type 'void (*)(void *, void *, void *, void *,
>> void *, void *, void *, void *, void *, void *, void *, void *, void
>> *)' /home/hornik/src/R/src/main/dotcode.c:1986:2: runtime error: call
>> to function coxmart through pointer to incorrect function type 'void
>> (*)(void *, void *, void *, void *, void *, void *, void *, void *)'
> This is something R does to call all .C() / .Fortran() functions. For
> example, coxph_wtest actually takes int*, int*, double*, double*,
> double*, double *, but R assumes that the calling convention is the
> same as if it took 6 times void* and calls it through a pointer of a
> different type [1]. In practice it works well, but formally, calling a
> function through a pointer of a different type is undefined behaviour.
> Unfortunately, there is no easy way to call arbitrary functions, like
> .C() and .Fortran() do, without either breaking some rules (which
> happens here) or generating function calls at runtime (like some
> foreign function interfaces do, which is less portable).
>
> This check may need suppressions for src/main/dotcode.c or special
> attributes [2] on R's do_dotCode.
Yes, yes. This is in base R and can be ignored by package authors.
We might consider outsourcing this e.g. to libffi at some point, but for
now, if you know an elegant, minimal way how to suppress this, and have
the time and energy, a patch would be welcome. We've known about this
since the start of this year, but it hasn't gotten high enough on
anyone's priority list, and then popped up here.
Best
Tomas
>
More information about the R-package-devel
mailing list