This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, libfortran] PR33253 namelist: reading back a string with apostrophe
- From: Tobias Burnus <burnus at net-b dot de>
- To: Jerry DeLisle <jvdelisle at verizon dot net>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 04 Sep 2007 11:42:59 +0200
- Subject: Re: [patch, libfortran] PR33253 namelist: reading back a string with apostrophe
- References: <46DC598F.50905@verizon.net>
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