[Rcpp-devel] NumericVector crashes in dataptr

Slava Mazur smazur at liquidnet.com
Wed May 7 22:17:43 CEST 2014


Hi Dirk,

> Have you by chance recently updated parts of R, Rcpp, RInside, ... but not the others?
Apparently yes; however, it was not done by me and the person who did this is not available at the moment.
So, I removed Rcpp and RInside and re-installed them with all dependencies and that resolved the issue.

Thanks,

SLAVA MAZUR
PRODUCT MANAGEMENT
P: +1-646-660-8021
M: 

LIQUIDNET
498 SEVENTH AVENUE, 15TH FLOOR, NEW YORK, NY, 10018
-----Original Message-----
From: Dirk Eddelbuettel [mailto:edd at debian.org] 
Sent: Wednesday, May 07, 2014 3:12 PM
To: Slava Mazur
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] NumericVector crashes in dataptr


Hi Slava

On 7 May 2014 at 15:06, Slava Mazur wrote:
| Hi Dirk,
| 
| Thanks for the prompt attention to this issue. It does not have anything to do with boost: the following behaves the same way:

Yes, I said the same in my email.  I was ready to remove it, but it has nothing to do with it.

| 
| #include <RInside.h>
| #include <Rcpp.h>
| 
| int main(int argc, char *argv[]) {
|     RInside Rinst(argc, argv);
|     const int N = 173;
|     double v[N];
|     std::fill(v, v+N, 0.0);
|     Rcpp::NumericVector x(v, v+N);
|     std::cout << "All good\n";
|     return 0;
| }
| 
| I tried to dig into it a little bit further and observed things that 
| look strange to me. Execution eventually gets to the following code in 
| Rcpp/routines.h[196:200]
| 
| inline void* dataptr(SEXP x){
|     typedef void* (*Fun)(SEXP) ;
|     static Fun fun = GET_CALLABLE("dataptr") ;
|     return fun(x) ;
| }
| 
| It seems that the "fun" pointer above points to the dataptr function itself and thus its call starts an unlimited recursion, which is confirmed by stepping through "return fun(x)" code in gdb.
| 
| It is interesting that if I recompile the same code with -DCOMPILING_RCPP the issue goes away. Is it an intended behavior? Please advise.

Have you by chance recently updated parts of R, Rcpp, RInside, ... but not the others?

If you upgraded Rcpp from 0.10.* to 0.11.* you MUST rebuild ALL dependent packages.

If you don't you get errors on startup.   

If you do, things tend to work, or else we by now have gotten thrown off CRAN as those good folks test relentlessly too.

Dirk

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com




More information about the Rcpp-devel mailing list