| 1 |
! { dg-do run } |
| 2 |
! pr 17285 |
| 3 |
! Test that namelist can read its own output. |
| 4 |
! At the same time, check arrays and different terminations |
| 5 |
! Based on example provided by [email protected] |
| 6 |
|
| 7 |
program pr17285 |
| 8 |
implicit none |
| 9 |
integer, dimension(10) :: number = 42 |
| 10 |
integer :: ctr, ierr |
| 11 |
namelist /mynml/ number |
| 12 |
open (10, status = "scratch") |
| 13 |
write (10,'(A)') & |
| 14 |
"&mynml number(:)=42,42,42,42,42,42,42,42,42,42,/ " |
| 15 |
write (10,mynml) |
| 16 |
write (10,'(A)') "&mynml number(1:10)=10*42 &end" |
| 17 |
rewind (10) |
| 18 |
do ctr = 1,3 |
| 19 |
number = 0 |
| 20 |
read (10, nml = mynml, iostat = ierr) |
| 21 |
if ((ierr /= 0) .or. (any (number /= 42))) & |
| 22 |
STOP 1 |
| 23 |
end do |
| 24 |
close(10) |
| 25 |
end program pr17285 |