我有一个包含姓名列表的程序:
implicit none
real,dimension(20)::Rc,Ic
integer::n_cyl,degree=4
namelist /vars/ n_cyl,degree,Rc,Ic
open(1,file='vars.txt')
read(1,nml=vars) ! line 19
close(1)
! ..............
open(1,file='vars.txt',STATUS='UNKNOWN',RECL=1000)
write(1,nml=vars)
close(1)
end
变量.txt:
&VARS
N_CYL= 12,
DEGREE= 4,
RC= 0.256000012 , 0.512000024 , 0.768000007 , 1.02400005 , 1.27999997 ,
1.43700004 , 1.59399998 , 1.72000003 , 1.84599996 , 1.97200000 , 2.09800005 ,
2.40289998 , 8*0.00000000 ,
IC= 1.77999997 , 1.71000004 , 1.57000005 , 1.44000006 , 1.25000000 ,
1.01999998 , 0.870000005 , 0.680000007 , 0.540000021 , 0.379999995 , 0.259999990 ,
0.170000002 , 8*0.00000000 ,
/
如果在Linux上使用gfortran进行编译,则它可以正常工作,但是在MinGW(Win32)上使用gfortran进行编译并运行时,它会抛出一个错误:
At line 19 of file elen.f90 (unit = 1, file = 'vars.txt'):
Fortran runtime error: Repeat count too large for namelist object rc
这是一个bug,还是代码中有问题?