1! { dg-do run }
2! { dg-options "-std=f2003 -fall-intrinsics" }
3! PR65596 Namelist reads too far.
4integer ,parameter :: CL=80
5integer ,parameter :: AL=4
6
7character(CL) :: mode
8character(CL) :: cats(AL)
9character(CL) :: dogs(AL)
10character(CL) :: rslt(AL)
11integer       :: ierr, k
12
13namelist / theList / cats, dogs, mode
14
15open(27,status="scratch")
16
17write(27,'(A)')  "&theList"
18write(27,'(A)')  " mode      = 'on'"
19write(27,'(A)')  " dogs      = 'Rover',"
20write(27,'(A)')  "             'Spot'"
21write(27,'(A)')  " cats      = 'Fluffy',"
22write(27,'(A)')  "             'Hairball'"
23write(27,'(A)') "/"
24rewind(27)
25
26mode    = 'off'
27cats(:) = '________'
28dogs(:) = '________'
29
30read (27, nml=theList, iostat=ierr)
31
32if (ierr .ne. 0) call abort
33
34rslt = ['Rover   ','Spot    ','________','________']
35if (any(dogs.ne.rslt)) call abort
36
37rslt = ['Fluffy  ','Hairball','________','________']
38if (any(cats.ne.rslt)) call abort
39
40close(27)
41
42contains
43
44subroutine abort()
45  close(27)
46  stop 500
47end subroutine abort
48
49end
50