1. xerrwv_ in src/scopmath/csoda.c is defined with 10 arguments but is called with 11. clang calls this an error while gcc (4.2) issues warnings. I could not find a way to make clang ignore this and so added an extra argument in the definition of xerrwv_.
2. In src/mesch/extras.c, function Mmv is called in a very strange way that the number and types of arguments are mismatched with the definition while gcc says nothing about it. I believe that this is a real bug in the old version of meschach, which is fixed in the most recent version (1.2b). So I just copied and pasted the relevant part.
With these two changes, clang nicely compiles NEURON 7.3 with the configuration as
Code: Select all
./configure --prefix=/Application/NEURON/nrn --with-iv=/Application/NEURON/iv --with-pic --with-nrnpython --with-paranrn --with-x --with-readline=/usr/local/opt/readline --with-pic CC='clang' CXX='clang++' CFLAGS='-O3 -Wno-return-type -Wno-implicit-function-declaration -Wno-implicit-int -fPIC' CXXFLAGS='-O3 -Wno-return-type -Wno-implicit-function-declaration -Wno-implicit-int -fPIC'
PS:
Here is the diff, including a few other fixes from meschach 1.2b.
Code: Select all
diff -rupN ../nrn-7.3/src/mesch/extras.c ./src/mesch/extras.c
--- ../nrn-7.3/src/mesch/extras.c 2013-03-07 21:12:04.000000000 +0900
+++ ./src/mesch/extras.c 2013-05-24 03:25:31.000000000 +0900
@@ -40,7 +40,7 @@ int len;
{
int i;
- if ( from >= to )
+ if ( from < to )
{
for ( i = 0; i < len; i++ )
*to++ = *from++;
@@ -481,7 +481,7 @@ int Aj0, Bj0, Cj0;
C[i][Cj0+j] += alpha*Mdot(p,&(A[i][Aj0]),&(B[j][Bj0]));
****************************************/
for ( i = 0; i < m; i++ )
- Mmv(n,p,alpha,&(A[i][Aj0]),B,Bj0,&(C[i][Cj0]));
+ Mmv(n,p,alpha,B,Bj0,&(A[i][Aj0]),1.0,&(C[i][Cj0]));
}
/* Mmtrmtr -- C <- C + alpha.A^T.B^T */
diff -rupN ../nrn-7.3/src/mesch/fft.c ./src/mesch/fft.c
--- ../nrn-7.3/src/mesch/fft.c 2013-03-07 21:12:04.000000000 +0900
+++ ./src/mesch/fft.c 2013-05-24 03:25:31.000000000 +0900
@@ -142,4 +142,5 @@ VEC *x_re, *x_im;
sv_mlt(-1.0,x_im,x_im);
fft(x_re,x_im);
sv_mlt(-1.0/((double)(x_re->dim)),x_im,x_im);
+ sv_mlt( 1.0/((double)(x_re->dim)),x_re,x_re);
}
diff -rupN ../nrn-7.3/src/mesch/ivecop.c ./src/mesch/ivecop.c
--- ../nrn-7.3/src/mesch/ivecop.c 2013-03-07 21:12:04.000000000 +0900
+++ ./src/mesch/ivecop.c 2013-05-24 03:25:32.000000000 +0900
@@ -394,8 +394,9 @@ PERM *order;
{
while ( x_ive[++i] < v )
;
- while ( x_ive[--j] > v )
- ;
+ --j;
+ while ( x_ive[j] > v && j != 0 )
+ --j;
if ( i >= j ) break;
tmp = x_ive[i];
diff -rupN ../nrn-7.3/src/scopmath/csoda.c ./src/scopmath/csoda.c
--- ../nrn-7.3/src/scopmath/csoda.c 2013-03-07 21:12:04.000000000 +0900
+++ ./src/scopmath/csoda.c 2013-05-24 03:24:57.000000000 +0900
@@ -4842,11 +4842,12 @@ doublereal *v, *w;
*/
} /* vmnorm_ */
-/* Subroutine */ int xerrwv_(msg, nmes, nerr, level, ni, i1, i2, nr, r1, r2)
+/* Subroutine */ int xerrwv_(msg, nmes, nerr, level, ni, i1, i2, nr, r1, r2, d)
integer *msg, *nmes;
integer *nerr;
integer *level, *ni, *i1, *i2, *nr;
doublereal *r1, *r2;
+integer d;
{
/* Initialized data */