Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_38.f90
blob5578654eea48d8cc978a22cfc74b6cdfb3e6ae51
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 <jvdelisle@gcc.gnu.org>
5 program main
6 implicit none
7 character(len=3) :: a
8 namelist /foo/ a
10 open(10, status="scratch", delim="quote")
11 a = 'a"a'
12 write(10,foo)
13 rewind 10
14 a = ""
15 read (10,foo) ! This gave a runtime error before the patch.
16 if (a.ne.'a"a') call abort
17 close (10)
19 open(10, status="scratch", delim="apostrophe")
20 a = "a'a"
21 write(10,foo)
22 rewind 10
23 a = ""
24 read (10,foo)
25 if (a.ne."a'a") call abort
26 close (10)
28 open(10, status="scratch", delim="none")
29 a = "a'a"
30 write(10,foo)
31 rewind 10
32 a = ""
33 read (10,foo)
34 if (a.ne."a'a") call abort
35 close (10)
36 end program main