[Rd] gfortran and BLAS on AMD64 Linux

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 9 11:25:58 CEST 2005

Linux users are used to all compilers using the same linkage conventions 
(those of pcc) whereas users of other platforms are used to the idea that 
code from different compilers cannot in general be mixed.

This is no longer true for gfortran on AMD64.  Given a double complex 
function like

       double complex function zdotc(n,zx,incx,zy,incy)

gfortran returns the result in a 128-bit XMM SSE register, whereas g77 
(and gcc using Rcomplex) would return the result in memory.

The result is that a BLAS compiled with g77 or gcc is not compatible with 
R compiled with gfortran and attempts to use the combination results in 
memory corruption.

We have already seen 3 instances of this

- the libblas that ships with FC3 is (AFAIK) compiled with g77
- ATLAS built with g77.
- Dr Goto's tuned BLAS.

It may be possible to devise a configure test for 2.2.0, but meanwhile be 
aware of the problem.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list