Index: libgfortran/io/list_read.c =================================================================== --- libgfortran/io/list_read.c (revision 128052) +++ libgfortran/io/list_read.c (working copy) @@ -887,7 +887,9 @@ read_character (st_parameter_dt *dtp, in goto get_string; default: - if (dtp->u.p.namelist_mode) + if (dtp->u.p.namelist_mode + && (dtp->u.p.current_unit->flags.delim == DELIM_APOSTROPHE + || dtp->u.p.current_unit->flags.delim == DELIM_QUOTE)) { unget_char (dtp,c); return; Index: gcc/testsuite/gfortran.dg/namelist_15.f90 =================================================================== --- gcc/testsuite/gfortran.dg/namelist_15.f90 (revision 128052) +++ gcc/testsuite/gfortran.dg/namelist_15.f90 (working copy) @@ -20,7 +20,7 @@ program namelist_15 namelist /mynml/ x - open (10, status = "scratch") + open (10, status = "scratch", delim='apostrophe') write (10, '(A)') "&MYNML" write (10, '(A)') " x = 3, 4, 'dd', 'ee', 'ff', 'gg'," write (10, '(A)') " 4, 5, 'hh', 'ii', 'jj', 'kk'," Index: gcc/testsuite/gfortran.dg/namelist_24.f90 =================================================================== --- gcc/testsuite/gfortran.dg/namelist_24.f90 (revision 128052) +++ gcc/testsuite/gfortran.dg/namelist_24.f90 (working copy) @@ -11,7 +11,7 @@ character*(8) names2(nd,nd) character*(8) names3(nd,nd) namelist / mynml / names, names2, names3 - open(unit=20,status='scratch') + open(unit=20,status='scratch', delim='apostrophe') write (20, '(a)') "&MYNML" write (20, '(a)') "NAMES = 25*'0'" write (20, '(a)') "NAMES2 = 25*'0'"