From pdalgd at gmail.com  Thu Sep  8 13:15:16 2011
From: pdalgd at gmail.com (peter dalgaard)
Date: Thu, 8 Sep 2011 13:15:16 +0200
Subject: [Rd] repeatable segfault - on Mac
In-Reply-To: <20072.30317.130733.348774@stat.math.ethz.ch>
References: <CAHHjBM7Q7T+zuK2w4yr580dOp0wYKR6eXV9oz_DhvnkWVnzM1A@mail.gmail.com>
	<F4958E2B-9A75-4C83-A773-A7940C46FA86@comcast.net>
	<20072.30317.130733.348774@stat.math.ethz.ch>
Message-ID: <BFEB9A7D-387C-42E3-9732-8D5043FB371E@gmail.com>


On Sep 8, 2011, at 10:01 , Martin Maechler wrote:

>>>>>> David Winsemius <dwinsemius at comcast.net>
>>>>>>    on Tue, 6 Sep 2011 00:38:13 -0400 writes:
> 
>> I can reproduce:
>> eigen(crossprod(matrix(1:2000, 50)) + (0+0i), T, T)
> 
>> *** caught segfault ***
>> address 0x102d0e028, cause 'memory not mapped'
> 
>> Traceback:
>> 1: .Call("La_rs_cmplx", x, only.values, PACKAGE = "base")
>> 2: eigen(crossprod(matrix(1:2000, 50)) + (0 + (0+0i)), T, T)
>> ##---- after restart
>>> sessionInfo()
>> R version 2.13.1 (2011-07-08)
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> 
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
> 
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
>> With OSX 10.5.8
> 
>> Also happens with 32 bit R
>> [R.app GUI 1.41 (5874) i386-apple-darwin9.8.0]
> 
> It does not happen on Linux (different versions) 
> nor Windows (2.13.1 patched, early August).
> 
> As this is calling LAPACK code,
> I guess that this is yet another case where the Mac version
> of optimized BLAS / LAPACK is playing wrongly.

Hmm, it does happen too on OSX (64bit) with a recent R-devel, vanilla compiled with

LAPACK_LIBS='-L$(R_HOME)/lib$(R_ARCH) -lRlapack'

I tried recompiling with -O0, still happening:


Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000102ddc128
0x000000010046805e in zher2k (uplo=@0x7fff5fbf9b0e, trans=@0x1039fc54b, n=@0x7fff5fbf98cc, k=@0x7fff5fbf98e0, alpha=@0x1039fc528, a=0x102198228, lda=@0x7fff5fbf9b08, b=0x1023abca8, ldb=@0x7fff5fbf98f4, beta=@0x1039fc660, c=0x10219d228, ldc=@0x7fff5fbf9b08, _uplo=1, _trans=12) at ../../../../R/src/extra/blas/cmplxblas.f:1566
1566	                     TEMP1 = ALPHA*DCONJG( B( J, L ) )
(gdb) where
#0  0x000000010046805e in zher2k (uplo=@0x7fff5fbf9b0e, trans=@0x1039fc54b, n=@0x7fff5fbf98cc, k=@0x7fff5fbf98e0, alpha=@0x1039fc528, a=0x102198228, lda=@0x7fff5fbf9b08, b=0x1023abca8, ldb=@0x7fff5fbf98f4, beta=@0x1039fc660, c=0x10219d228, ldc=@0x7fff5fbf9b08, _uplo=1, _trans=12) at ../../../../R/src/extra/blas/cmplxblas.f:1566
#1  0x00000001039939aa in zhetrd (uplo=@0x7fff5fbf9b0e, n=@0x7fff5fbf9b08, a=0x102198028, lda=@0x7fff5fbf9b08, d=0x100597f28, e=0x102e02d58, tau=0x1023ab828, work=0x1023abaa8, lwork=@0x7fff5fbf9a30, info=@0x7fff5fbf9a44, _uplo=1) at ../../../../R/src/modules/lapack/cmplx.f:8841
#2  0x000000010399209e in zheev (jobz=@0x7fff5fbf9b0f, uplo=@0x7fff5fbf9b0e, n=@0x7fff5fbf9b08, a=0x102198028, lda=@0x7fff5fbf9b08, w=0x100597f28, work=0x1023ab828, lwork=@0x7fff5fbf9b04, rwork=0x102e02d58, info=@0x7fff5fbf9b00, _jobz=10096376, _uplo=36013056) at ../../../../R/src/modules/lapack/cmplx.f:8275
#3  0x00000001007f102e in modLa_rs_cmplx (xin=0x102258400, only_values=0x1009a0ef8) at ../../../../R/src/modules/lapack/Lapack.c:776
#4  0x0000000100103baf in La_rs_cmplx (x=0x102258400, only_values=0x1009a0ef8) at ../../../R/src/main/lapack.c:113
#5  0x000000010007a82b in do_dotcall (call=0x1026c62e8, op=0x100864718, args=0x1026d9278, env=0x1026d4278) at ../../../R/src/main/dotcode.c:845
Segmentation fault


(The segfault appears to be gdb itself tripping over)

-pd


> 
> Martin Maechler
> 
>> David Winsemius
> 
>> On Sep 6, 2011, at 12:12 AM, robin hankin wrote:
> 
>>> Hi.  macosx 10.6.8
>>> 
>>> With R-2.13.1 and also revision 56948 I get the following repeatable  
>>> segfault:
>>> 
>>> 
>>> 
>>> wt118:~% R --vanilla --quiet
>>>> R.Version()
>>> $platform
>>> [1] "x86_64-apple-darwin9.8.0"
>>> 
>>> $arch
>>> [1] "x86_64"
>>> 
>>> $os
>>> [1] "darwin9.8.0"
>>> 
>>> $system
>>> [1] "x86_64, darwin9.8.0"
>>> 
>>> $status
>>> [1] ""
>>> 
>>> $major
>>> [1] "2"
>>> 
>>> $minor
>>> [1] "13.1"
>>> 
>>> $year
>>> [1] "2011"
>>> 
>>> $month
>>> [1] "07"
>>> 
>>> $day
>>> [1] "08"
>>> 
>>> $`svn rev`
>>> [1] "56322"
>>> 
>>> $language
>>> [1] "R"
>>> 
>>> $version.string
>>> [1] "R version 2.13.1 (2011-07-08)"
>>> 
>>>> eigen(crossprod(matrix(1:2000, 50)) + (0+0i), T, T)
>>> 
>>> *** caught segfault ***
>>> address 0x1038000a8, cause 'memory not mapped'
>>> 
>>> Traceback:
>>> 1: .Call("La_rs_cmplx", x, only.values, PACKAGE = "base")
>>> 2: eigen(crossprod(matrix(1:2000, 50)) + (0 + (0+0i)), T, T)
>>> 
>>> 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: 2
>>> wt118:~%
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Robin Hankin
>>> Uncertainty Analyst
>>> hankin.robin at gmail.com
>>> 
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
> 
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] repeatable segfault - on Mac
peter dalgaard