1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2  character*20 c(25), cv
3  character(kind=1,len=59) msg
4  logical*2 v(5), lv
5  integer*1 stat1
6  integer*2 stat4
7  integer*8 stat8, iv
8
9  inquire(10)
10  inquire(file='abc')
11  inquire(10, pos=ipos, iomsg=msg, iostat=stat1)
12  inquire(file='abc', &
13      access=c(1), action=c(2), asynchronous=c(3), blank=c(4), decimal=c(5), &
14      delim=c(6), direct=c(7), encoding=c(8), form=c(9), formatted=c(10), &
15      name=c(11), pad=c(12), position=c(13), read=c(14), readwrite=c(15), &
16      round=c(16), sequential=c(17), sign=c(18), stream=c(19), &
17      unformatted=c(20), write=c(21), &
18      err=9, &
19      nextrec=nextrec, number=number, pos=jpos, recl=jrecl, size=jsize, &
20      iomsg=msg, &
21      iostat=stat4, &
22      exist=v(1), named=v(2), opened=v(3), pending=v(4))
23  inquire(pending=v(5), file='abc')
24  inquire(10, id=id, pending=v(5))
25
26  ! using variable 'cv' multiple times seems to be allowed
27  inquire(file='abc', &
28      access=cv, action=cv, asynchronous=cv, blank=cv, decimal=cv, &
29      delim=cv, direct=cv, encoding=cv, form=cv, formatted=cv, &
30      name=cv, pad=cv, position=cv, read=cv, readwrite=cv, &
31      round=cv, sequential=cv, sign=cv, stream=cv, &
32      unformatted=cv, write=cv, &
33      nextrec=iv, number=iv, pos=iv, recl=iv, size=iv, &
34      exist=lv, named=lv, opened=lv, pending=lv)
35
36  !ERROR: INQUIRE statement must have a UNIT number or FILE specifier
37  inquire(err=9)
38
39  !ERROR: If FILE appears, UNIT must not appear
40  inquire(10, file='abc', blank=c(22), iostat=stat8)
41
42  !ERROR: Duplicate FILE specifier
43  inquire(file='abc', file='xyz')
44
45  !ERROR: Duplicate FORM specifier
46  inquire(form=c(1), iostat=stat1, form=c(2), file='abc')
47
48  !ERROR: Duplicate SIGN specifier
49  !ERROR: Duplicate READ specifier
50  !ERROR: Duplicate WRITE specifier
51  inquire(1, read=c(1), write=c(2), sign=c(3), sign=c(4), read=c(5), write=c(1))
52
53  !ERROR: Duplicate IOMSG specifier
54  inquire(10, iomsg=msg, pos=ipos, iomsg=msg)
55
56  !ERROR: If ID appears, PENDING must also appear
57  inquire(file='abc', id=id)
58
599 continue
60end
61