Rcpp11 / attributes

Standalone implementation of Rcpp attributes.
Other
3 stars 1 forks source link

Segfault on sourceCpp #25

Open kevinushey opened 10 years ago

kevinushey commented 10 years ago

Calling sourceCpp on the following file:

// [[Rcpp::export]]
//List subset_test_list(List x, CharacterVector y) {
//    return x[y];
//}

causes a segfault. Seems to fail here:

(lldb) frame select 4
frame #4: 0x000000010cbda6b6 attributes.so`get_function_signature(txt=0x000000010890ac20, pos=<unavailable>) + 246 at attributes.cpp:37
   34       
   35       // skip comments
   36       while( current_line[0] == '/' ){
-> 37         current_line = CHAR(STRING_ELT(txt, ++pos)) ;
   38       }
   39       
   40       // get everything before the first '{'

from

(lldb) frame select 5
frame #5: 0x000000010cbdb736 attributes.so`parse_cpp_function(txt=<unavailable>, line=<unavailable>) + 38 at attributes.cpp:158
   155    SEXP parse_cpp_function( SEXP txt, SEXP line ){
   156      
   157      int pos = INTEGER(line)[0] ;
-> 158      std::string signature = get_function_signature( txt, pos ) ;
   159      
   160      // find last ')' and first '('
   161      std::string::size_type endParenLoc = signature.find_last_of(')');