Hi, the following program shows a runtime bug with gfortran 4.3.x: % cat gfcbug79.f90 program gfcbug79 implicit none integer, parameter :: nnml = 10 character(len=8) :: model = "" namelist /NML/ model open (nnml, file='gfcbug79.nml') write(nnml,*) "&nml" write(nnml,*) " model='foo'! This is a just comment" write(nnml,*) "/" rewind(nnml) read (nnml, nml=NML) close(nnml) write (*,nml=NML) end program gfcbug79 % gfc gfcbug79.f90 && ./a.out At line 14 of file gfcbug79.f90 (unit = 10, file = 'gfcbug79.nml') Fortran runtime error: Invalid string input in item 0 % Inserting a blank before the comment character ("!") is a workaround, but gfortran should nevertheless be fixed. Cheers, -ha
I will investigate this. i have another namelist patch I am working as well.
Subject: Bug 36657 Author: jvdelisle Date: Sat Jun 28 21:46:53 2008 New Revision: 137236 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137236 Log: 2008-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36657 * io/list_read.c (read_character): Check for '!' along with separators. (find_nml_name): Likewise and eat the comment if found. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/list_read.c
I plan to backport this one to 4.3.
Subject: Bug 36657 Author: jvdelisle Date: Wed Jul 2 04:44:21 2008 New Revision: 137336 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137336 Log: 2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org PR fortran/36676 PR fortran/36657 PR fortran/36546 Backport from trunk. * io/list_read.c (find_nml_name): Use unget_char before eat_separator. (read_character): Check for '!' along with separators. (eat_separator): Add tab character to condition for looping past whitespace. Modified: branches/gcc-4_3-branch/libgfortran/ChangeLog branches/gcc-4_3-branch/libgfortran/io/list_read.c
Subject: Bug 36657 Author: jvdelisle Date: Wed Jul 2 04:52:47 2008 New Revision: 137337 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137337 Log: 2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org PR fortran/36676 PR fortran/36657 PR fortran/36546 PR fortran/36538 * gfortran.dg/namelist_50.f90 * gfortran.dg/namelist_51.f90 * gfortran.dg/namelist_48.f90 * gfortran.dg/namelist_49.f90 Added: branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/namelist_48.f90 branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/namelist_49.f90 branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/namelist_50.f90 branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/namelist_51.f90 Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed on Trunk and 4.3
Target Milestone is 4.3.3?
The target milestone does not matter in this case. The fix will be in the next 4.3.x release which will be 4.3.2, from the looks.