I'm very green with R, so maybe this is not a bug, but it looks like one to me. The following program segfaults at the second call to Rf_PrintValue(). To failure depends on the value of the y-string. E.g., if I change it from "coverage" to, say, "COVERAGE", the segfault does not occur.
/* bug.c */ #include <stdio.h> #include <Rinternals.h> #include <Rembedded.h> int main(int argc, char **argv) { char *x = "foo"; char *y = "coverage"; SEXP x_r, y_r; Rf_initEmbeddedR(argc, argv); PROTECT( x_r = mkChar( x ) ); Rf_PrintValue( x_r ); printf( "OK\n" ); PROTECT( y_r = mkChar( y ) ); Rf_PrintValue( y_r ); printf( "OK\n" ); UNPROTECT( 2 ); return 0; } I compile this code with: % env -i PATH=/bin:/usr/bin ./myR/bin/R CMD LINK gcc -g -I./R-2.9.0/src/include -L./myR/lib64/R/lib -lR -lRblas bug.c -o bug A run looks like this: % env -i PATH=/bin:/usr/bin R_HOME=$(./myR/bin/R RHOME) ./bug -q --vanilla <CHARSXP: "foo"> OK <CHARSXP: "coverage"> *** caught segfault *** address 0x6c6c756e2e8d, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: 1 aborting ... zsh: segmentation fault env -i PATH=/bin:/usr/bin R_HOME=$(./myR/bin/R RHOME) ./bug -q --vanilla I think the problem has to do with the fact that there may already exist a cached copy of "coverage" . Regards, Kynn PS: Any comments on my code would be very welcome; I'm very much the noob with all this. [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel