Re: [R-pkg-devel] clang-UBSAN

2024-05-13 Thread Gábor Csárdi
The rhub package should be able to reproduce that, see
https://github.com/r-hub/rhub#readme

Or you can use the clang-asan container directly:
https://r-hub.github.io/containers/

Gabor

On Mon, May 13, 2024 at 12:31 AM Kaifeng Lu  wrote:
>
> Dear friends,
>
> I am developing an R package built with Rcpp. The package passed the test
> with devtools::check() before submission to CRAN, but failed with the
> following clang-UBSAN issue after submission to CRAN:
>
> /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/caster.h:30:25:
> runtime error: nan is outside the range of representable values of type
> 'int'
>
> Is there any way to reproduce the error before submitting the package to
> CRAN?
>
> Thank you very much for helping!
>
> Regards,
> Kaifeng
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

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


Re: [R-pkg-devel] clang-UBSAN

2024-05-13 Thread Ivan Krylov via R-package-devel
В Sun, 12 May 2024 14:43:18 -0400
Kaifeng Lu  пишет:

> /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/caster.h:30:25:
> runtime error: nan is outside the range of representable values of
> type 'int'

On line 4618 of src/misc.cpp of the lrstat package, you have a
suspicious default parameter value:

>> const int n = NA_REAL

NA_REAL is a special kind of NaN, and C++ signed integers cannot
represent NaNs. You probably meant NA_INTEGER.

I think that Rcpp::traits::input_parameter takes care of
asking R to cast NA_REAL to NA_INTEGER, so this shouldn't directly
cause problems, but without a link to the code and the full error
report we have to resort to forbidden OSINT techniques [1], which don't
always work reliably and may attract the wrong kind of attention on the
darknet [2].

> Is there any way to reproduce the error before submitting the package
> to CRAN?

Yes.

If you use containers, try the rocker/r-devel-ubsan-clang [3] image
that should already contain a "sanitized" build of R produced with the
clang compiler.

If that doesn't help, start with a Fedoda 36 installation and follow
the description [4] to install clang and compile R from source with
sanitizers enabled. This procedure is described in more detail in WRE
4.3.4 [5].

If you start having problems using the Docker/podman image or compiling
R from source, don't hesitate to ask further questions.

-- 
Best regards,
Ivan

[1]
Such as searching your name on CRAN and GitHub.

[2]
Such as Google suggesting AI-powered results.

[3]
https://rocker-project.org/images/

[4]
https://www.stats.ox.ac.uk/pub/bdr/memtests/README.txt

[5]
https://cran.r-project.org/doc/manuals/R-exts.html#Using-Undefined-Behaviour-Sanitizer

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


[R-pkg-devel] clang-UBSAN

2024-05-12 Thread Kaifeng Lu
Dear friends,

I am developing an R package built with Rcpp. The package passed the test
with devtools::check() before submission to CRAN, but failed with the
following clang-UBSAN issue after submission to CRAN:

/data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/caster.h:30:25:
runtime error: nan is outside the range of representable values of type
'int'

Is there any way to reproduce the error before submitting the package to
CRAN?

Thank you very much for helping!

Regards,
Kaifeng

[[alternative HTML version deleted]]

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