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