gfortran simply continues (with a warning) if one has a wrong namelist in
STDIN.

If one has an IOSTAT variable, it prints the warning but continues with an
IOSTAT == 0.

Using any other means of input (internal unit, external unit) works as
expected, i.e. run-time error - or a non-zero return value for iostat.

Example:

$ gfortran hjff.f90; cat foo.dat|./a.out
Cannot match namelist object name tag3
namelist read: misplaced = sign
 unreachable           0

$ cat foo.dat
&nml tag3=5 /

$ cat hjff.f90
namelist /nml/ tag
character(len=200) str
str ='&nml tg=5 /'
read(*,nml=nml,iostat=ios)
print *, 'unreachable', ios
end

Source code: See line 2964

http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgfortran/io/list_read.c;hb=HEAD#l2964


-- 
           Summary: Namelist read: Not aborted when reading from STDIN
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45108

Reply via email to