2021-09-06 16:19:20 +08:00
|
|
|
! RUN: %python %S/test_errors.py %s %flang_fc1
|
2019-05-01 02:28:16 +08:00
|
|
|
character(kind=1,len=50) internal_file
|
|
|
|
character(kind=2,len=50) internal_file2
|
|
|
|
character(kind=4,len=50) internal_file4
|
2020-08-26 01:34:33 +08:00
|
|
|
character(kind=1,len=50) internal_fileA(20)
|
2019-05-01 02:28:16 +08:00
|
|
|
character(kind=1,len=111) msg
|
|
|
|
character(20) advance
|
2020-08-26 01:34:33 +08:00
|
|
|
character(20) :: cvar;
|
|
|
|
character, parameter :: const_internal_file = "(I6)"
|
|
|
|
character, parameter :: const_cvar = "Ceci n'est pas une pipe."
|
2019-05-01 02:28:16 +08:00
|
|
|
integer*1 stat1
|
|
|
|
integer*2 stat2, id2
|
|
|
|
integer*8 stat8
|
|
|
|
integer :: iunit = 10
|
2020-08-26 01:34:33 +08:00
|
|
|
integer, parameter :: junit = 11, const_size = 13, const_int = 15
|
|
|
|
integer :: vv(10) = 7
|
2019-05-01 02:28:16 +08:00
|
|
|
|
|
|
|
namelist /mmm/ mm1, mm2
|
|
|
|
namelist /nnn/ nn1, nn2
|
|
|
|
|
|
|
|
advance='no'
|
|
|
|
|
|
|
|
open(10)
|
|
|
|
|
|
|
|
read*
|
2019-06-27 06:46:48 +08:00
|
|
|
print*, 'Ok'
|
2019-05-01 02:28:16 +08:00
|
|
|
read(*)
|
|
|
|
read*, jj
|
|
|
|
read(*, *) jj
|
|
|
|
read(unit=*, *) jj
|
|
|
|
read(*, fmt=*) jj
|
|
|
|
read(*, '(I4)') jj
|
|
|
|
read(*, fmt='(I4)') jj
|
|
|
|
read(fmt='(I4)', unit=*) jj
|
|
|
|
read(iunit, *) jj
|
|
|
|
read(junit, *) jj
|
2020-08-26 01:34:33 +08:00
|
|
|
read(10, *) jj, cvar, cvar(7:17)
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file, *) jj
|
2020-08-26 01:34:33 +08:00
|
|
|
read(internal_fileA(3), *) jj
|
|
|
|
read(internal_fileA(4:9), *) jj
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, nnn)
|
|
|
|
read(internal_file, nnn)
|
|
|
|
read(internal_file, nml=nnn)
|
2020-08-26 01:34:33 +08:00
|
|
|
read(const_internal_file, *)
|
2019-05-01 02:28:16 +08:00
|
|
|
read(fmt=*, unit=internal_file)
|
|
|
|
read(nml=nnn, unit=internal_file)
|
|
|
|
read(iunit, nnn)
|
|
|
|
read(10, nml=nnn)
|
|
|
|
read(10, asynchronous='no') jj
|
|
|
|
read(10, asynchronous='yes') jj
|
|
|
|
read(10, eor=9, advance='no', fmt='(I4)') jj
|
|
|
|
read(10, eor=9, advance='no', fmt='(I4)') jj
|
|
|
|
read(10, asynchronous='yes', id=id) jj
|
|
|
|
read(10, '(I4)', advance='no', asynchronous='yes', blank='null', &
|
|
|
|
decimal='comma', end=9, eor=9, err=9, id=id, iomsg=msg, iostat=stat2, &
|
|
|
|
pad='no', round='processor_defined', size=kk) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Invalid character kind for an internal file variable
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file2, *) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Invalid character kind for an internal file variable
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file4, *) jj
|
|
|
|
|
2020-08-26 01:34:33 +08:00
|
|
|
!ERROR: Internal file must not have a vector subscript
|
|
|
|
read(internal_fileA(vv), *) jj
|
|
|
|
|
|
|
|
!ERROR: Input variable 'const_int' must be definable
|
|
|
|
read(11, *) const_int
|
|
|
|
|
|
|
|
!ERROR: SIZE variable 'const_size' must be definable
|
|
|
|
read(11, pos=ipos, size=const_size, end=9)
|
|
|
|
|
|
|
|
!ERROR: Input variable 'const_cvar' must be definable
|
|
|
|
read(11, *) const_cvar
|
|
|
|
|
|
|
|
!ERROR: Input variable 'const_cvar' must be definable
|
|
|
|
read(11, *) const_cvar(3:13)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Duplicate IOSTAT specifier
|
2019-05-01 02:28:16 +08:00
|
|
|
read(11, pos=ipos, iostat=stat1, iostat=stat2)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Duplicate END specifier
|
2019-05-01 02:28:16 +08:00
|
|
|
read(11, end=9, pos=ipos, end=9)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Duplicate NML specifier
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, nml=mmm, nml=nnn)
|
|
|
|
|
|
|
|
!ERROR: READ statement must have a UNIT specifier
|
|
|
|
read(err=9, iostat=stat8) jj
|
|
|
|
|
|
|
|
!ERROR: READ statement must not have a DELIM specifier
|
|
|
|
!ERROR: READ statement must not have a SIGN specifier
|
|
|
|
read(10, delim='quote', sign='plus') jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If NML appears, REC must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, nnn, rec=nn)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If NML appears, FMT must not appear
|
|
|
|
!ERROR: If NML appears, a data list must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, fmt=*, nml=nnn) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If UNIT=* appears, REC must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(*, rec=13)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If UNIT=* appears, POS must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(*, pos=13)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If UNIT=internal-file appears, REC must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file, rec=13)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If UNIT=internal-file appears, POS must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file, pos=13)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If REC appears, END must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, fmt='(I4)', end=9, rec=13) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If REC appears, FMT=* must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, *, rec=13) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ADVANCE appears, UNIT=internal-file must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file, '(I4)', eor=9, advance='no') jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ADVANCE appears, an explicit format must also appear
|
|
|
|
!ERROR: If EOR appears, ADVANCE with value 'NO' must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, eor=9, advance='yes')
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If EOR appears, ADVANCE with value 'NO' must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, eor=9)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: Invalid ASYNCHRONOUS value 'nay'
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, asynchronous='nay') ! prog req
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(*, asynchronous='yes')
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(internal_file, asynchronous='y'//'es')
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, id=id)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, asynchronous='n'//'o', id=id)
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If POS appears, REC must not appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, pos=13, rec=13) jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If DECIMAL appears, FMT or NML must also appear
|
|
|
|
!ERROR: If BLANK appears, FMT or NML must also appear
|
|
|
|
!ERROR: Invalid DECIMAL value 'Punkt'
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, decimal='Punkt', blank='null') jj
|
|
|
|
|
2019-06-26 06:59:30 +08:00
|
|
|
!ERROR: If ROUND appears, FMT or NML must also appear
|
|
|
|
!ERROR: If PAD appears, FMT or NML must also appear
|
2019-05-01 02:28:16 +08:00
|
|
|
read(10, pad='no', round='nearest') jj
|
|
|
|
|
|
|
|
!ERROR: ID kind (2) is smaller than default INTEGER kind (4)
|
|
|
|
read(10, id=id2, asynchronous='yes') jj
|
|
|
|
|
|
|
|
9 continue
|
|
|
|
end
|
2020-08-26 01:34:33 +08:00
|
|
|
|
|
|
|
subroutine s(aa, n)
|
|
|
|
integer :: aa(5,*)
|
|
|
|
integer, intent(in) :: n
|
|
|
|
integer :: bb(10), vv(10)
|
|
|
|
type tt
|
|
|
|
real :: x, y, z
|
|
|
|
end type tt
|
|
|
|
type(tt) :: qq(20)
|
|
|
|
|
|
|
|
vv = 1
|
|
|
|
|
|
|
|
read(*, *) aa(n,1)
|
|
|
|
read(*, *) aa(n:n+2,2)
|
|
|
|
read(*, *) qq(2:5)%y
|
|
|
|
|
|
|
|
!ERROR: Input variable 'n' must be definable
|
|
|
|
read(*, *) n
|
|
|
|
|
2020-10-02 03:08:04 +08:00
|
|
|
!ERROR: Whole assumed-size array 'aa' may not appear here without subscripts
|
2020-08-26 01:34:33 +08:00
|
|
|
read(*, *) aa
|
|
|
|
end
|