[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / io05.f90
blobad80f93ec01618c4c65906906cc43702fb89c6fc
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 character*20 c(25), cv
4 character(kind=1,len=59) msg
5 character, parameter :: const_round = "c'est quoi?"
6 logical*2 v(5), lv
7 integer*1 stat1
8 integer*2 stat4
9 integer*8 stat8, iv
10 integer, parameter :: const_id = 1
12 inquire(10)
13 inquire(file='abc')
14 inquire(10, pos=ipos, iomsg=msg, iostat=stat1)
15 inquire(file='abc', &
16 access=c(1), action=c(2), asynchronous=c(3), blank=c(4), decimal=c(5), &
17 delim=c(6), direct=c(7), encoding=c(8), form=c(9), formatted=c(10), &
18 name=c(11), pad=c(12), position=c(13), read=c(14), readwrite=c(15), &
19 round=c(16), sequential=c(17), sign=c(18), stream=c(19), &
20 unformatted=c(20), write=c(21), &
21 err=9, &
22 nextrec=nextrec, number=number, pos=jpos, recl=jrecl, size=jsize, &
23 iomsg=msg, &
24 iostat=stat4, &
25 exist=v(1), named=v(2), opened=v(3), pending=v(4))
26 inquire(pending=v(5), file='abc')
27 inquire(10, id=id, pending=v(5))
28 inquire(10, id=const_id, pending=v(5))
29 inquire(10, carriagecontrol=c(1)) ! nonstandard
31 ! using variable 'cv' multiple times seems to be allowed
32 inquire(file='abc', &
33 access=cv, action=cv, asynchronous=cv, blank=cv, decimal=cv, &
34 delim=cv, direct=cv, encoding=cv, form=cv, formatted=cv, &
35 name=cv, pad=cv, position=cv, read=cv, readwrite=cv, &
36 round=cv, sequential=cv, sign=cv, stream=cv, &
37 unformatted=cv, write=cv, &
38 nextrec=iv, number=iv, pos=iv, recl=iv, size=iv, &
39 exist=lv, named=lv, opened=lv, pending=lv)
41 !ERROR: INQUIRE statement must have a UNIT number or FILE specifier
42 inquire(err=9)
44 !ERROR: If FILE appears, UNIT must not appear
45 inquire(10, file='abc', blank=c(22), iostat=stat8)
47 !ERROR: Duplicate FILE specifier
48 inquire(file='abc', file='xyz')
50 !ERROR: Duplicate FORM specifier
51 inquire(form=c(1), iostat=stat1, form=c(2), file='abc')
53 !ERROR: Duplicate SIGN specifier
54 !ERROR: Duplicate READ specifier
55 !ERROR: Duplicate WRITE specifier
56 inquire(1, read=c(1), write=c(2), sign=c(3), sign=c(4), read=c(5), write=c(1))
58 !ERROR: Duplicate IOMSG specifier
59 inquire(10, iomsg=msg, pos=ipos, iomsg=msg)
61 !ERROR: If ID appears, PENDING must also appear
62 inquire(file='abc', id=id)
64 !ERROR: ROUND variable 'const_round' must be definable
65 inquire(file='abc', round=const_round)
67 9 continue
68 end