pgi f90 compiler 6.1 and large array support

Hi all,
I am having problems compiling netcdf 3.6.0-p1 with the pgf90 v 6.1 compiler with large array support, i.e. -mcmodel=medium -Mlarge_arrays on an x86_64 system. The problem seems to be that the size f90 intrinsic and friends does not return default type integers when large arrays are enabled. I guess this could be fixed by finding out what integer kind size returns. I've used something like

real, dimension(2) :: dummyarray
integer, parameter :: sizek = kind(size(dummyarray))

and declare all start,count,stride,etc arrays
integer(kind=sizek), dimension(nf90_max_var_dims)

Does this make sense. Would the underlying C library support this to start with? I also realise that the f90 interface is generated using m4. My m4 knowledge is rudimentary to say the least. If someone could point me in the right direction I could try and cook something up.
Cheers
magnus
--
Magnus Hagdorn
Department of Geology and Geophysics
The University of Edinburgh
Grant Institute
West Mains Road
Edinburgh EH9 3JW
Scotland
PHONE: (+44) 131 650 5917
FAX:   (+44) 131 668 3184
email: Magnus.Hagdorn@xxxxxxxxxxxx