This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, libfortran] PR33253 namelist: reading back a string with apostrophe


Hi Jerry,

Jerry DeLisle wrote:
> The title of this PR is a bit misleading.  The failure occurs with a
> string without the apostrophe as well.  The problem here is that when
> reading a string, we look at the first character and see if it is a
> delimiter ' or " .  If not we would skip out and not read the rest of
> the string.

For me, it does not fully work yet. Using the following program:
--------------------
program main
  implicit none
  character(len=3) :: a
  namelist /foo/ a
  open(10,delim="APOSTROPHE")
  a = "a'a"
  write(10,foo)
  write (*,foo)
  rewind 10
  read (10,foo)
end program main
--------------------

ifort, NAG f95, g95, openf95 write all (modulo spacing):

 &FOO
 A       = 'a''a'
 /

gfortran writes:

&FOO
 A='a'a',  /

and has then problems reading this back:
Fortran runtime error: Invalid string input in item 0

(As gfortran properly reads  A='a''a' this seems to be only a writing
and not a reading problem.)

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]