Reading back a namelist string which contains an apostrophe doesn't work. I am marking this as an enhancement because reading back what we wrote with a namelist isn't guaranteed to work (see note 10.37 in the working draft). It does work with ifort, for example.
$ cat namelist.f90 program main implicit none character(len=3) :: a namelist /foo/ a open(10,status="scratch") a = "a'a" write(10,foo) write (*,foo) rewind 10 read (10,foo) end program main $ gfortran namelist.f90 $ ./a.out &FOO A=a'a, / At line 10 of file namelist.f90 (unit = 10, file = '/tmp/gfortrantmpy3HLPb') Fortran runtime error: Cannot match namelist object name a'a, -- Summary: namelist: reading back a string with apostrophe Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkoenig at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33253