Hello everyone, I am trying to test a package binsegRcpp. I pass the size of max_segments vector as zero it doesn't throw any segfault when I am trying to access the zeroth index element. Instead gives a garbage value or error like negative length vectors not allowed. Rcpp::List rcpp_binseg_normal (const Rcpp::NumericVector data_vec, const Rcpp::IntegerVector max_segments) { int kmax = max_segments[0]; } Link to the package: https://github.com/tdhock/binsegRcpp/blob/master/src/rcpp_interface.cpp
How is a zero-length vector represented in R? Does it still store a pointer to some location? If so Is there a way to get this segfault detected. I tried using rhub::check it doesn't give any error. I tried using sanitizers as well still no luck. Can someone please suggest a way to detect this in R. Thanks
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel