From pgilbert@bank-banque-canada.ca  Thu Jan 17 20:26:13 2002
From: pgilbert@bank-banque-canada.ca (pgilbert@bank-banque-canada.ca)
Date: Thu, 17 Jan 2002 21:26:13 +0100 (MET)
Subject: [Rd] eigen segfault with GCC 3 on Solaris (PR#1272)
Message-ID: <200201172026.VAA03052@pubhealth.ku.dk>

A message this morning reminded me of a previous problem I had which should be
noted in R bugs, but is really a problem with gcc 3 I believe. It may be only a
problem on Solaris, but AFAIK has not been checked on other platforms. I
resolved it by going back to a gcc 2.9x.x (which a few people suggested). Below
is the relevant part of my original post, an example which provokes the
segfault, and some gdb information from Peter Dalgaard.

PG>I have now tested R 1.3.1 compiled with GCC 3.0.2 on Solaris and the example
I
PG>previously posted (repeated below) still gives a segmentation fault, as it
does
PG>with GCC 3.0.1 but not with 2.95.2. The eigen calculation sometimes needs to
be
PG> repeated several times before the segmentation fault occurs. La.eigen does
not
PG> cause a problem. (The problem occurred with R-devel too, but I have not
tested
PG> that with GCC 3.0.2.)

PD>I don't know if it helps, but I see it too... 3.0.1 on Solaris 2.7.
PD>
PD>gdb says that it is happening at l.2144 of eigen.f:
PD>
PD>2142    C
PD>2143                DO 760 J = M, EN
PD>2144                   RA = RA + H(I,J) * H(J,NA)
PD>2145                   SA = SA + H(I,J) * H(J,EN)
PD>2146      760       CONTINUE
PD>2147    C
PD>
PD>J prints as 7289784 for me, which looks a bit weird since M and EN are
PD>17 and 18 respectively. However, optimizers sometimes cause this sort
PD>of thing.

----- example -----


zz <- t(matrix(c(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.082008166, -0.066322053,
-0.115616348,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.038919428,  0.009703382,
0.115944209,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.007823026, -0.068859673,
0.025264756,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.067027108,  0.087934957,
-0.316974768,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.024890008,  0.052195412,
-0.015138322,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.028192857, -0.004832597,
0.207879665,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.078706928, -0.012801413,
0.425960682,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0.102169750,  0.163238356,
-0.150373125,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.002685166,  0.014355904,
0.197912183,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  0.042937314,  0.115719388,
0.679370293,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,  0.032306141,  0.263227910,
0.009171148,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,  0.008238734, -0.031480706,
0.051976566,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,  0.015219148,  0.221345314,
0.020146770,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,  0.039741608,  0.092955553,
-0.262550823,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,  0.012624418,  0.047810873,
0.201673308,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -0.114163303,  0.417786916,
0.253110874,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,  0.049894329, -0.155696562,
-0.049735728,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  0.006112607,  0.074242237,
0.034046467
), 18,18))

eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
eigen(zz)$values
Segmentation Fault - core dumped

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] eigen segfault with GCC 3 on Solaris (PR#1272)
pgilbert@bank-banque-canada.ca