2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_41.f90
blob16e0d42b8af4eef435494ad4f4faf593d5e4caf0
1 ! { dg-do run { target fd_truncate } }
2 ! PR34291 Segfault on &end in namelist expanded read of character
3 implicit none
4 character(len=10), dimension(2) :: var
5 namelist /inx/ var
6 var = "goodbye"
7 open(unit=11, status='scratch')
8 write (11, *) "&inx"
9 write (11, *) "var(1)='hello'"
10 write (11, *) "&end"
11 rewind (11)
12 read(11,nml=inx)
13 if (var(1) /= 'hello' .and. var(2) /= 'goodbye') call abort
14 var = "goodbye"
15 rewind (11)
16 write (11, *) "$inx"
17 write (11, *) "var(1)='hello'"
18 write (11, *) "$end"
19 rewind (11)
20 read(11,nml=inx)
21 if (var(1) /= 'hello' .and. var(2) /= 'goodbye') call abort
22 end