Hi,
Although the following code seems valid:
implicit none logical :: l = .FALSE. integer :: i = -1 real :: r = 0. character(5) :: c = '' namelist /input/l, i, r, c open (UNIT = 101, FILE = 'input.dat', STATUS = 'OLD') read (101, input) close (101) write (*,input) end
There should be a warning or error of some sort when reading a namelist with a non-standard termination, like for example:
&input l = T, & i = 1, r = 2., c = '12345' /
The warning is especially useful if the -stand option is given during compliation. Here's what compiling with gfortran shows, followed by ifort's equivalent:
...:~$ ll `which gfortran` lrwxrwxrwx 1 root root 12 May 3 12:57 /usr/bin/gfortran -> gfortran-4.8* ...:~$ ll `which ifort` -rwxr-xr-x 1 root root 4013312 Apr 25 08:19 /opt/intel/composer_xe_2013_sp1.3.174/bin/intel64/ifort* ...:~$ gfortran test_namelist.f90 ...:~$ ./a.out At line 11 of file test_namelist.f90 (unit = 101, file = 'input.dat') Fortran runtime error: namelist not terminated with / or &end ...:~$ ifort -stand test_namelist.f90 ...:~$ ./a.out&INPUT L = T, I = -1, R = 0.0000000E+00, C = /
As of today, I know ending the namelist with & is an extension, but since I shouldn't have to be aware of every single extension in ifort (or gfortran), I just spent two days trying to find a non-existent bug in the code.