https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65596
Bug ID: 65596 Summary: [4.9 Regression] NAMELIST bug with f2003: reads too far Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dominiq at lps dot ens.fr CC: jvdelisle at gcc dot gnu.org >From https://gcc.gnu.org/ml/fortran/2015-03/msg00138.html, the following test integer ,parameter :: CL=80 integer ,parameter :: AL=4 character(CL) :: mode character(CL) :: crats(AL) character(CL) :: drogs(AL) integer :: ierr, k character(CL) :: msg namelist / theList / crats, drogs, mode 4 format (a4, "(", i1, ")='", a, "'") msg = 'none' mode = 'off' crats(:) = '____' drogs(:) = '____' read (*, nml=theList, iomsg=msg, iostat=ierr) print *, "ierr=", ierr print *, "message='"//trim(msg)//"'" do k=1,AL print 4, "drogs", k, trim(drogs(k)) end do print *, "" do k=1,AL print 4, "crats", k, trim(crats(k)) end do end compiled with -std=f2003 and with the following input &theList mode = 'on' drogs = 'Grover', 'Sprout' crats = 'Flurry', 'Hairball' / gives the wrong output at run time ierr= -1 message='End of file' drog(1)='Grover' drog(2)='Sprout' drog(3)='crats = 'Flurry', 'Hairball' / ' drog(4)='____' crat(1)='____' crat(2)='____' crat(3)='____' crat(4)='____' Revision r208241 (2014-03-01) is OK, r208311 (2014-03-04) is not (r208302 for pr60148?). This appears to be fixed on trunk: wrong output at r215860 (2014-10-03) and r216098 (2014-10-10) is OK. I did not find obvious candidate for the fix.