blob: 3c439c3bed780a7dd3c912d1791e1f824fa21737 [file] [log] [blame]
! { dg-do run { target fd_truncate } }
! PR34291 Segfault on &end in namelist expanded read of character
implicit none
character(len=10), dimension(2) :: var
namelist /inx/ var
var = "goodbye"
open(unit=11, status='scratch')
write (11, *) "&inx"
write (11, *) "var(1)='hello'"
write (11, *) "&end"
rewind (11)
read(11,nml=inx)
if (var(1) /= 'hello' .and. var(2) /= 'goodbye') STOP 1
var = "goodbye"
rewind (11)
write (11, *) "$inx"
write (11, *) "var(1)='hello'"
write (11, *) "$end"
rewind (11)
read(11,nml=inx)
if (var(1) /= 'hello' .and. var(2) /= 'goodbye') STOP 2
end