Re: [Rd] changes in R-devel and zero-extent objects in Rcpp

2024-06-10 Thread Ben Bolker
Thanks, that's very useful. AFAICT, in the problematic case we are doing some linear algebra with zero-column matrices that are mathematically well-defined (and whose base-R equivalents work correctly). It's maybe not surprising that Eigen/RcppEigen would do some weird stuff in this edge c

Re: [Rd] changes in R-devel and zero-extent objects in Rcpp

2024-06-10 Thread Mikael Jagan
> Date: Sat, 8 Jun 2024 19:16:22 -0400 > From: Ben Bolker > > The ASAN errors occur *even if the zero-length object is not actually > accessed*/is used in a perfectly correct manner, i.e. it's perfectly > legal in base R to define `m <- numeric(0)` or `m <- matrix(nrow

Re: [Rd] changes in R-devel and zero-extent objects in Rcpp

2024-06-08 Thread Ben Bolker
The ASAN errors occur *even if the zero-length object is not actually accessed*/is used in a perfectly correct manner, i.e. it's perfectly legal in base R to define `m <- numeric(0)` or `m <- matrix(nrow = 0, ncol = 0)`, whereas doing the equivalent in Rcpp will (now) lead to an ASAN error.

Re: [Rd] changes in R-devel and zero-extent objects in Rcpp

2024-06-08 Thread Kevin Ushey
IMHO, this should be changed in both Rcpp and downstream packages: 1. Rcpp could check for out-of-bounds accesses in cases like these, and emit an R warning / error when such an access is detected; 2. The downstream packages unintentionally making these out-of-bounds accesses should be fixed to a