Hey all,
I have a couple of R packages using RStan on CRAN. One of these is LMMELSM (Latent multivariate mixed effects location scale models).
I received an alert from CRAN last month that it is hitting a clang-UBSAN error. I cannot figure out what is triggering this issue.
I use rstantools, I have updated the rstantools configuration in the latest submission, and I do not see any errors in my tests. Their UBSAN seems to trigger on the lmmelsmPred.stan file.
Github for lmmelsm: GitHub - stephensrmmartin/LMMELSM: R Package for fitting latent multivariate mixed effects location scale models.
CRAN UBSAN Error page: https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/LMMELSM/tests/testthat.Rout
The main lines seem to be:
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:347:25: runtime error: applying non-zero offset 400 to null pointer
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:347:25: runtime error: applying non-zero offset 8 to null pointer
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:374:24: runtime error: applying non-zero offset 8 to null pointer
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:374:81: runtime error: subtraction of unsigned offset from 0x000000000008 overflowed to 0x000000000008
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:374:24: runtime error: applying non-zero offset 8 to null pointer
LMMELSM.Rcheck/tests/testthat.Rout:/data/gannet/ripley/R/test-clang/RcppEigen/include/Eigen/src/Core/Block.h:374:81: runtime error: subtraction of unsigned offset from 0x000000000008 overflowed to 0x000000000008
Please fix and resubmit.
Does anyone have any clues or hints about what can cause these types of errors? I don’t believe I do anything particularly exotic in the stan files. The test data contains no NAs, and that same data is used elsewhere in lmmelsm test runs that throw no errors.
Moreover, the actual tests run fine - I can run all tests successfully on my machine, my osx vm, my windows vm, on rhub, etc. The only apparent problem is with UBSAN flagging these issues.