| 1 |
! { dg-do run } |
| 2 |
! PR33253 namelist: reading back a string, also fixed writing with delimiters. |
| 3 |
! Test case modified from that of the PR by |
| 4 |
! Jerry DeLisle <[email protected]> |
| 5 |
program main |
| 6 |
implicit none |
| 7 |
character(len=3) :: a |
| 8 |
character(25) :: b |
| 9 |
namelist /foo/ a |
| 10 |
|
| 11 |
open(10, status="scratch", delim="quote") |
| 12 |
a = 'a"a' |
| 13 |
write(10,foo) |
| 14 |
rewind 10 |
| 15 |
a = "" |
| 16 |
read (10,foo) ! This gave a runtime error before the patch. |
| 17 |
if (a.ne.'a"a') STOP 1 |
| 18 |
close (10) |
| 19 |
|
| 20 |
open(10, status="scratch", delim="apostrophe") |
| 21 |
a = "a'a" |
| 22 |
write(10,foo) |
| 23 |
rewind 10 |
| 24 |
a = "" |
| 25 |
read (10,foo) |
| 26 |
if (a.ne."a'a") STOP 2 |
| 27 |
close (10) |
| 28 |
|
| 29 |
open(10, status="scratch", delim="none") |
| 30 |
a = "a'a" |
| 31 |
write(10,foo) |
| 32 |
rewind (10) |
| 33 |
read(10,"(a)") b |
| 34 |
if (b .ne. "&FOO") STOP 3 |
| 35 |
read(10,"(a)") b |
| 36 |
if (b .ne. " A=a'a") STOP 4 |
| 37 |
read(10,"(a)") b |
| 38 |
if (b .ne. " /") STOP 5 |
| 39 |
close(10) |
| 40 |
end program main |