[Rcpp-devel] Segfaults in custom code and test.NumericMatrix.cumsum

Michael Shvartsman mshvarts at umich.edu
Fri Mar 2 20:01:24 CET 2012


Update: I haven't run a memory checker, but what I did do is test binaries compiled on the working OSX machine and they worked fine. So it's a compiler problem most likely. 

Working hypothesis: this is some flavor of the XCode 4.2 compiler problem I've seen mentioned in a few other emails to this list, and some obscure difference between the two machines makes it pop up on one and not the other. 

I've got a reasonable workaround and am on a deadline so I'm unlikely to investigate this further :). 

		Mike. 

On Feb 8, 2012, at 9:28 AM, Dirk Eddelbuettel wrote:

> 
> On 7 February 2012 at 15:47, Michael Shvartsman wrote:
> | Hi everyone - 
> | 
> | 	I'm running the same R/Rcpp codebase on about 8 machines, 4 of them OSX and 4 Ubuntu. Rcpp passes unit tests and my non-unittest code runs fine on 7 of the 8 and gives sensible results, so I'm reasonably sure it's correct. However, test.NumericMatrix.cumsum gives me a segfault on the 8th machine, as does my own code (which does some indexing into, multiplying and summing of NumericVector's and NumericMatrix's). I am guessing / thinking that these might be related, which is why I am mentioning both. 
> | 	The machine is a dual-hexacore Mac Pro box with OSX lion, Xcode 4.2, R 2.14.1. One of the functioning machines has slightly older hardware but the same version of OSX, same version of Xcode, and same version of R. I'm a bit at a loss. Unittest error reproduced below. My code just gives a 'memory not mapped' segfault. Any ideas of where else to look? Thanks, 
> 
> No good idea here. You seem to checked the obvious culprits. Maybe run a
> memory checker on that machine?
> 
> Dirk
> 
> | 
> | 		Mike Shvartsman. 
> | 
> | ========== The unitTest segfault ===========
> | Executing test function test.NumericMatrix.cumsum  ... 
> |  *** caught segfault ***
> | address 0x0, cause 'unknown'
> | 
> | Traceback:
> |  1: .Primitive(".Call")(<pointer: 0x104c03f80>, x)
> |  2: funx(x)
> |  3: all.equal(target, current, tolerance = tolerance, ...)
> |  4: checkEquals(funx(x), t(apply(x, 1, cumsum)), msg = "cumsum")
> |  5: func()
> |  6: system.time(func())
> |  7: doTryCatch(return(expr), name, parentenv, handler)
> |  8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
> |  9: tryCatchList(expr, classes, parentenv, handlers)
> | 10: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste(prefix, "\n  ", sep = "")    }    else prefix <- "Error : "    msg <- paste(prefix, conditionMessage(e), "\n", sep = "")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
> | 11: try(system.time(func()))
> | 12: .executeTestCase(funcName, envir = sandbox, setUpFunc = .setUp,     tearDownFunc = .tearDown)
> | 13: .sourceTestFile(testFile, testSuite$testFuncRegexp)
> | 14: runTestSuite(testSuite)
> | aborting ...
> | Segmentation fault: 11
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel at lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 
> -- 
> "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
> dark to read." -- Groucho Marx
> 
> 



More information about the Rcpp-devel mailing list