Skip to content

[Rcpp-devel] Runtime error from Rcpp::depends with gcc sanitizers

2 messages · Ralf Stubner, Dirk Eddelbuettel

#
Hi list,

I run into run-time errors when using rhub::check_with_sanitizers(),
which can be reproduced like this:

$ docker run -it --rm rhub/rocker-gcc-san bash
root at c56cfa20e903:/# RDscript -e "install.packages('Rcpp')"
[...]
root at c56cfa20e903:/# cat > foo.cpp
#include <Rcpp.h>
// [[Rcpp::depends(Matrix)]]

// [[Rcpp::export]]
int foo() { return 0; }

root at c56cfa20e903:/# RDscript -e "Rcpp::sourceCpp('foo.cpp')"
attributes.cpp:168:11: runtime error: load of value 104, which is not a
valid value for type 'bool'
attributes.cpp:168:11: runtime error: load of value 2, which is not a
valid value for type 'bool'

There is no error if I omit Rcpp::depends:

root at c56cfa20e903:/# cat > bar.cpp
#include <Rcpp.h>

// [[Rcpp::export]]
int foo() { return 0; }

root at c56cfa20e903:/# RDscript -e "Rcpp::sourceCpp('bar.cpp')"
root at c56cfa20e903:/#

These errors do not occur in the tests run by CRAN (or they are filtered
out there). Does anyone have an idea where this might come from and how
it could be fixed?

Thanks
Ralf
1 day later
#
On 12 February 2019 at 14:10, Ralf Stubner wrote:
| Hi list,
| 
| I run into run-time errors when using rhub::check_with_sanitizers(),
| which can be reproduced like this:
| 
| $ docker run -it --rm rhub/rocker-gcc-san bash
| root at c56cfa20e903:/# RDscript -e "install.packages('Rcpp')"
| [...]
| root at c56cfa20e903:/# cat > foo.cpp
| #include <Rcpp.h>
| // [[Rcpp::depends(Matrix)]]
| 
| // [[Rcpp::export]]
| int foo() { return 0; }
| 
| root at c56cfa20e903:/# RDscript -e "Rcpp::sourceCpp('foo.cpp')"
| attributes.cpp:168:11: runtime error: load of value 104, which is not a
| valid value for type 'bool'
| attributes.cpp:168:11: runtime error: load of value 2, which is not a
| valid value for type 'bool'
| 
| There is no error if I omit Rcpp::depends:
| 
| root at c56cfa20e903:/# cat > bar.cpp
| #include <Rcpp.h>
| 
| // [[Rcpp::export]]
| int foo() { return 0; }
| 
| root at c56cfa20e903:/# RDscript -e "Rcpp::sourceCpp('bar.cpp')"
| root at c56cfa20e903:/#
| 
| These errors do not occur in the tests run by CRAN (or they are filtered
| out there). Does anyone have an idea where this might come from and how
| it could be fixed?

I don't :-/  These tools are very helpful, but on occassion also very finicky.

Dirk