[patch, libfortran] PR33253 namelist: reading back a string with apostrophe
Jerry DeLisle
jvdelisle@verizon.net
Wed Sep 5 00:35:00 GMT 2007
Tobias Burnus wrote:
> 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
>
Ok, I will will see what I can do here.
Jerry
More information about the Fortran
mailing list