This program: character*20 a(3) namelist / nam / a read (4, nml=nam) write(6, nml=nam) end given the following input (fort.4): &nam a(1)='aap noot mies wim zus jet', a(2)='surf.pressure', a(3)='apekool', / produces the following output: &NAM A=aap noot mies wim zu,a(2)='surf.pressure',a(3)='apekool' , / This mixing of quoted and unquoted strings cannot be correct. The a(2) and a(3) are weird.
Another example. With gfortran 4.3.0 it print the following, with NAG f95, g95, ifort and gfortran 4.2.2 the expected. b1: " AAP NOOT MIES WIM ZUS JET " b2: "b(2)='SURF.PRESSURE' " b3: "b(3)='APEKOOL' " Expected: b1: " AAP NOOT MIES WIM ZUS JET " b2: "SURF.PRESSURE " b3: "APEKOOL " program test implicit none character(len=45) :: b(3) namelist /nam/ b b = 'x' open(99) write(99,'(4(a,/),a)') "&NAM", & " b(1)=' AAP NOOT MIES WIM ZUS JET',", & " b(2)='SURF.PRESSURE',", & " b(3)='APEKOOL',", & " /" rewind(99) read(99,nml=nam) close(99,status='delete') print '(3a)', 'b1: "',b(1),'"' print '(3a)', 'b2: "',b(2),'"' print '(3a)', 'b3: "',b(3),'"' print '(/,"Expected:")' print '(a)', 'b1: " AAP NOOT MIES WIM ZUS JET "' print '(a)', 'b2: "SURF.PRESSURE "' print '(a)', 'b3: "APEKOOL "' end program test
*** Bug 33422 has been marked as a duplicate of this bug. ***
Two witnesses should be enough ...
I am investigating.
Subject: Bug 33421 Author: jvdelisle Date: Fri Sep 28 02:57:41 2007 New Revision: 128857 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128857 Log: 2007-09-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/33421 * io/list_read.c (read_character): Revert r128057. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/list_read.c
I have reverted the offending patch and will reopen pr33253, the least of the two evils. This is one of those bugs where the fix for one breaks the other. I am still trying to puzzle it out.