1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 character(kind
=1,len
=50) internal_file
3 character(kind
=1,len
=100) msg
5 character, parameter :: const_internal_file
*(*) = "(I6)"
11 integer, parameter :: junit
= 11
12 integer, pointer :: a(:)
13 integer, parameter :: const_id
= 66666
14 procedure(), pointer :: procptr
18 namelist /nnn
/ nn1
, nn2
38 write(internal_file
, *)
39 write(internal_file
, fmt
=*)
40 write(internal_file
, fmt
=1) 'Ok'
41 write(internal_file
, nnn
)
42 write(internal_file
, nml
=nnn
)
43 write(unit
=internal_file
, *)
44 write(fmt
=*, unit
=internal_file
)
45 write(10, advance
='yes', fmt
=1) 'Ok'
46 write(10, *, delim
='quote', sign
='plus') jj
47 write(10, '(A)', advance
='no', asynchronous
='yes', decimal
='comma', &
48 err
=9, id
=id
, iomsg
=msg
, iostat
=stat2
, round
='processor_defined', &
54 allocate(a(2), stat
=stat2
)
55 allocate(a(8), stat
=stat8
)
57 !ERROR: Duplicate UNIT specifier
58 write(internal_file
, unit
=*)
60 !ERROR: WRITE statement must have a UNIT specifier
63 !ERROR: WRITE statement must not have a BLANK specifier
64 !ERROR: WRITE statement must not have a END specifier
65 !ERROR: WRITE statement must not have a EOR specifier
66 !ERROR: WRITE statement must not have a PAD specifier
67 write(*, eor
=9, blank
='zero', end=9, pad
='no')
69 !ERROR: If NML appears, REC must not appear
70 !ERROR: If NML appears, FMT must not appear
71 !ERROR: If NML appears, a data list must not appear
72 write(10, nnn
, rec
=40, fmt
=1) 'Ok'
74 !ERROR: Internal file variable 'const_internal_file' is not definable
75 !BECAUSE: '"(I6)"' is not a variable or pointer
76 write(const_internal_file
, fmt
=*)
78 !ERROR: If UNIT=* appears, POS must not appear
79 write(*, pos
=n
, nml
=nnn
)
81 !ERROR: If UNIT=* appears, REC must not appear
84 !ERROR: If UNIT=internal-file appears, POS must not appear
85 write(internal_file
, err
=9, pos
=n
, nml
=nnn
)
87 !ERROR: If UNIT=internal-file appears, REC must not appear
88 write(internal_file
, rec
=n
, err
=9)
90 !ERROR: If UNIT=* appears, REC must not appear
93 !ERROR: I/O unit must be a character variable or a scalar integer expression
96 !ERROR: If ADVANCE appears, UNIT=internal-file must not appear
97 write(internal_file
, advance
='yes', fmt
=1) 'Ok'
99 !ERROR: If ADVANCE appears, an explicit format must also appear
100 write(10, advance
='yes') 'Ok'
102 !ERROR: Invalid ASYNCHRONOUS value 'non'
103 write(*, asynchronous
='non')
105 !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
106 write(*, asynchronous
='yes')
108 !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
109 write(internal_file
, asynchronous
='yes')
111 !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
112 write(10, *, id
=id
) "Ok"
114 !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
115 write(10, *, id
=id
, asynchronous
='no') "Ok"
117 !ERROR: If POS appears, REC must not appear
118 write(10, pos
=13, rec
=13) 'Ok'
120 !ERROR: If DECIMAL appears, FMT or NML must also appear
121 !ERROR: If ROUND appears, FMT or NML must also appear
122 !ERROR: If SIGN appears, FMT or NML must also appear
123 !ERROR: Invalid DECIMAL value 'Komma'
124 write(10, decimal
='Komma', sign
='plus', round
='down') jj
126 !ERROR: If DELIM appears, FMT=* or NML must also appear
127 !ERROR: Invalid DELIM value 'Nix'
128 write(delim
='Nix', fmt
='(A)', unit
=10) 'Ok'
130 !ERROR: ID kind (1) is smaller than default INTEGER kind (4)
131 write(id
=id1
, unit
=10, asynchronous
='Yes') 'Ok'
133 !ERROR: ID variable 'const_id' is not definable
134 !BECAUSE: '66666_4' is not a variable or pointer
135 write(10, *, asynchronous
='yes', id
=const_id
, iostat
=stat2
) 'Ok'
139 !ERROR: Output item must not be a procedure
141 !ERROR: Output item must not be a procedure
143 !ERROR: Output item must not be a procedure