aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr109662-a.f90
blob: dc05d6b7a80a185982790e8cc496c23cb224b0e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
! { dg-do run }
! { dg-options "-std=f2003" }
! PR109662-a semi-colon after namelist name accepted on input. 
program testnmlread
  implicit none
  character(16) :: line = '&stuff; n = 759/'
  character(100)::message
  integer       :: n, i, ioresult
  namelist/stuff/n
  message = ""
  ioresult = 0
  n = 99
  read(line,nml=stuff,iostat=ioresult)
  if (ioresult == 0) STOP 13 ! Should error with the semi-colon in there.

  ! Intentional short input (-> EOF)
  line = "&stuff"
  ! Problem manifests on two bad reads on same string.
  do i = 1, 6
    n = -1
    ioresult = 0

    read (line,nml=stuff,iostat=ioresult)
    if (n /= -1) STOP 24
    if (ioresult == 0) STOP 25
  end do

end program testnmlread