[Rd] memory access question

Therneau, Terry M., Ph.D. therne@u @end|ng |rom m@yo@edu
Sun Jun 30 04:27:15 CEST 2019


I had a problem with the latest iteration of the survival package  (one that I hope to 
post to Github next week) where it would die in strange ways, i.e., work on one box and 
not on another, a vignette would compile if I invoked Sweave myself but fail in R CMD 
build, etc.   The type of thing that says quite loudly that there is a memory issue 
somewhere in a C routine.   The kind that has potential for making you tear your hair out.

In any case, I finally built an ASAN aware version of R on my test box, and it failed on 
something that looked minor.  I was reading one element past one of the input vectors, 
though I never used the value.   In essence I had  "temp = input[i]" one line in front of 
the "if() break" test for i.   (The while loop for i was running from n-1 to 0; one often 
goes from largest to smallest time value in survival code, so i was -1 at the failure).    
I repaired this of course, but with no real hope that it could be the actual issue causing 
my errors.   And now the weird behavior seems to have gone away!  The argument in question 
was about midway on the argument list BTW.

My question is, should I have been as surprised as I am?

And let me give a big thank you to the authors of the "debugging" section of the packages 
guide.  Things that reliably die are one thing, but I don't know how I would have found 
this one without the help.

Terry T.


	[[alternative HTML version deleted]]



More information about the R-devel mailing list