If just a comment is in the NAMELIST input the READ fails

________________________________________________________________________________
VERSION:
________________________________________________________________________________
gfortran -dumpversion
GNU Fortran (GCC) 4.3.2 20080827 (beta) 2
Copyright (C) 2008 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
________________________________________________________________________________
EXECUTION:
________________________________________________________________________________
./bugA
================================================================================
 ===> FOR: 
&CMD
 I=          1,
 J=          2,
 K=          3,  /

================================================================================
 ===> FOR: I=10 , J=20 K=30 ! change all three values
&CMD
 I=         10,
 J=         20,
 K=         30,  /

================================================================================
 ===> FOR: 
&CMD
 I=         10,
 J=         20,
 K=         30,  /

================================================================================
 ===> FOR: ! change no values
 E-R-R-O-R: PROCESSING COMMAND LINE, IOSTAT=        5010
 Cannot match namelist object name change                                       
&CMD
 I=         10,
 J=         20,
 K=         30,  /

________________________________________________________________________________
CODE:
________________________________________________________________________________
cat bugA.f90
program cmdline
! comment by itself causes error in gfortran
   call process(' ')
   call process('I=10 , J=20 K=30 ! change all three values')
   call process(' ')
   call process('! change no values')  ! CAUSES ERROR IN GFORTRAN, NOT G95
end program cmdline
!=======================================================================--------
!()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
!=======================================================================--------
subroutine process(string)
implicit none
character(len=*) :: string
character(len=132) :: lines(3)
character(len=255) :: message
INTEGER :: I=1,J=2,K=3
integer ios
NAMELIST /CMD/ I,J,K
save cmd
lines(1)='&cmd'
lines(2)=string
lines(3)='/'

WRITE(*,'(80(''=''))')
write(*,*)'===> FOR: ',string(:len_trim(string))

READ(lines,NML=CMD,IOSTAT=ios,IOMSG=message)
if(ios.ne.0)then
   write(*,*)'E-R-R-O-R: PROCESSING COMMAND LINE, IOSTAT=',IOS
   write(*,*)message
endif
write(*,NML=CMD)

return
end subroutine process
!=======================================================================--------
!()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
!=======================================================================--------


-- 
           Summary: NAMELIST input with just a comment ("&NAME ! comment \")
                    fails
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: urbanjost at comcast dot net


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

Reply via email to