g95 compilation of netcdf


Hello everybody,

1) I've managed to compile netcdf 3.5.1 3.6.0-p1 and a beta3.6.1 (not tested) with g95/gcc. I advocate using g95 as a f77 compiler instead of g77, which is less efficient and requires its own libraries. I have F90FLAGS=-fno-second-underscore FFLAGS=-fno-second-underscore FC=g95

2) I think there is a small bug in f90/netcdf_attributes.f90: I'm running on a 64 bit system (Athlon64 4000/FC4), and the default int for g95 is i8, whereas for C it's still i4. Netcdf finds this fine (fortran int = C long), but one of the interfaces in f90/netcdf_attributes.f90 is missing a typecast to standard int type:

l.177
nf90_put_att_one_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
  1, valuesA)

should be

nf90_put_att_one_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
  1, int(valuesA))

Otherwise the 4byte valuesA is passed to a routine expecting a 8byte int.
The same thing is already(correctly) done in the previous routine:
nf90_put_att_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int,
  size(values), int(values))

3) It would be nice to have parameters in fortran/cfortran.h for g95 and especially the intel compilers - they are not identified, and the default options are bad at linkage (still underscore problems).

Matthieu

--
===============================================================
Dr. Matthieu Verstraete                 mailto:mjv500@xxxxxxxxxx
Dept. of Physics, University of York,     tel: +44 1904 43 22 08
Heslington, YO10 5DD York, United Kingdom fax: +44 1904 43 22 14