Skip to content

Build fails for R 1.6.2: [base-Ex.Rout] Error 1

5 messages · Thomas Lumley, Peter Dalgaard, Marc Schwartz +1 more

#
I am trying to build 1.6.2 from source RPM's on RedHat 9, but encounter 
a failure when running the base tests. An inspection of 
base-Ex.Rout.fail reveals the following:

 > ##___ Examples ___:
 >
 > var(1:10)# 9.166667
[1] 9.166667
 >
 > var(1:5,1:5)# 2.5
[1] 2.5
 >
 > ## Two simple vectors
 > cor(1:10,2:11)# == 1
[1] 1
 >
 >
 >  stopifnot(  is.na(var(1)),
+            !is.nan(var(1)))
Error: !is.nan(var(1)) is not TRUE
Execution halted

Any ideas?

TIA,
chris fonnesbeck
#
On Tue, 8 Apr 2003, Christopher Fonnesbeck wrote:

            
Yes. The version of gcc in RedHat 9 will not distinguish NA and NaN at
least sometimes, when optimization is used.  The bug report for RedHat is
at
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=88174

A fix has been added to the development version of R.


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle
#
Thomas Lumley <tlumley at u.washington.edu> writes:
...
Well, let's call it a workaround. The fix is gcc 3.3.

...but it's a one-liner: Inside the 

static double R_ValueOfNA(void)

in src/main/arithmetic.c

declare x volatile, i.e.

static double R_ValueOfNA(void)
{
    /* The gcc shipping with RedHat 9 gets this wrong without
     * the volatile declaration. Thanks to Marc Schwartz. */
    volatile ieee_double x;
    x.word[hw] = 0x7ff00000;
    x.word[lw] = 1954;
    return x.value;
}
#
Peter Dalgaard BSA wrote:
I can verify that the above change does work for R 1.6.2 and passes make 
check under RH 9.

Chris, download the source tar file from CRAN and as Peter has pointed 
out, make the change in line 119 in arithmetic.c.  Then:

./configure
make
make check
make install

HTH,

Marc Schwartz
#
Thanks,

I have made the change; once I build the rpm binary I will submit it to 
Martyn Plummer for the CRAN ftp site.

Chris Fonnesbeck
Marc Schwartz wrote: