[patch, libfortran] PR33253 namelist: reading back a string with apostrophe
Tobias Burnus
burnus@net-b.de
Tue Sep 4 09:43:00 GMT 2007
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
More information about the Fortran
mailing list