[Rcpp-devel] NumericVector crashes in dataptr
Slava Mazur
smazur at liquidnet.com
Wed May 7 18:07:45 CEST 2014
Hi,
I observe a crash in NumericVector constructor with new versions of Rcpp/RInside: (0.11.1 and 0.2.11 respectively).
Here is a test c++ code:
////////// dataptr_crash.cpp //////////////////////////////////////////////////////////
#include <RInside.h>
#include <Rcpp.h>
#include <boost/shared_ptr.hpp>
static boost::shared_ptr<RInside> Rinst;
int main(int argc, char *argv[]) {
Rinst = boost::shared_ptr<RInside>(new RInside(argc, argv));
int N = 173;
double v[N];
std::fill(v, v+N, 0.0);
Rcpp::NumericVector x(v, v+N);
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
to build:
gcc -g3 -O0 -I$R_HOME/include -I$R_HOME/library/Rcpp/include -I$R_HOME/library/RInside/include -L$R_HOME/lib -L$R_HOME/library/Rcpp/lib -L$R_HOME/library/RInside/lib -lR -lRcpp -lRInside dataptr_crash.cpp
environment:
uname -r
2.6.32-279.5.2.el6.x86_64
gcc --version
gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> library(Rcpp)
> library(RInside)
> sessionInfo()
R version 3.0.3 (2014-03-06)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RInside_0.2.11 Rcpp_0.11.1
The test program above crashes in Rcpp::NumericVector ctor and the top of the stack looks like the following:
Program received signal SIGSEGV, Segmentation fault.
0x000000000040315e in dataptr (x=Cannot access memory at address 0x7fffff3feff8
)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:196
196 inline void* dataptr(SEXP x){
(gdb) bt
#0 0x000000000040315e in dataptr (x=Cannot access memory at address 0x7fffff3feff8
)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:196
#1 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#2 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#3 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#4 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#5 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#6 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#7 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#8 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#9 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#10 0x00000000004031da in dataptr (x=0x146f290)
at /quantpkgs/R/R-3.0.3/lib64/R/library/Rcpp/include/Rcpp/routines.h:199
#11 0x00000000004031da in dataptr (x=0x146f290)
---Type <return> to continue, or q <return> to quit---q
However, I couldn't reach the bottom of the stack -- it's too long.
In older versions of R/Rcpp/RInside it works fine. Boost version seems to be irrelevant.
Is this a known issue?
Thanks,
SLAVA MAZUR
PRODUCT MANAGEMENT
LIQUIDNET
498 SEVENTH AVENUE, 15TH FLOOR, NEW YORK, NY 10018
THINK HFT IS OLD NEWS?
SO DO WE.<http://www.liquidnet.com/news/740-asset-managers-rely-on-liquidnet-to-protect-them-from-hft/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140507/2b4a1eea/attachment.html>
More information about the Rcpp-devel
mailing list