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
16 namelist /nnn
/ nn1
, nn2
36 write(internal_file
, *)
37 write(internal_file
, fmt
=*)
38 write(internal_file
, fmt
=1) 'Ok'
39 write(internal_file
, nnn
)
40 write(internal_file
, nml
=nnn
)
41 write(unit
=internal_file
, *)
42 write(fmt
=*, unit
=internal_file
)
43 write(10, advance
='yes', fmt
=1) 'Ok'
44 write(10, *, delim
='quote', sign
='plus') jj
45 write(10, '(A)', advance
='no', asynchronous
='yes', decimal
='comma', &
46 err
=9, id
=id
, iomsg
=msg
, iostat
=stat2
, round
='processor_defined', &
52 allocate(a(2), stat
=stat2
)
53 allocate(a(8), stat
=stat8
)
55 !ERROR: Duplicate UNIT specifier
56 write(internal_file
, unit
=*)
58 !ERROR: WRITE statement must have a UNIT specifier
61 !ERROR: WRITE statement must not have a BLANK specifier
62 !ERROR: WRITE statement must not have a END specifier
63 !ERROR: WRITE statement must not have a EOR specifier
64 !ERROR: WRITE statement must not have a PAD specifier
65 write(*, eor
=9, blank
='zero', end=9, pad
='no')
67 !ERROR: If NML appears, REC must not appear
68 !ERROR: If NML appears, FMT must not appear
69 !ERROR: If NML appears, a data list must not appear
70 write(10, nnn
, rec
=40, fmt
=1) 'Ok'
72 !ERROR: Internal file variable 'const_internal_file' must be definable
73 write(const_internal_file
, fmt
=*)
75 !ERROR: If UNIT=* appears, POS must not appear
76 write(*, pos
=n
, nml
=nnn
)
78 !ERROR: If UNIT=* appears, REC must not appear
81 !ERROR: If UNIT=internal-file appears, POS must not appear
82 write(internal_file
, err
=9, pos
=n
, nml
=nnn
)
84 !ERROR: If UNIT=internal-file appears, REC must not appear
85 write(internal_file
, rec
=n
, err
=9)
87 !ERROR: If UNIT=* appears, REC must not appear
90 !ERROR: Must have INTEGER type, but is REAL(4)
93 !ERROR: If ADVANCE appears, UNIT=internal-file must not appear
94 write(internal_file
, advance
='yes', fmt
=1) 'Ok'
96 !ERROR: If ADVANCE appears, an explicit format must also appear
97 write(10, advance
='yes') 'Ok'
99 !ERROR: Invalid ASYNCHRONOUS value 'non'
100 write(*, asynchronous
='non')
102 !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
103 write(*, asynchronous
='yes')
105 !ERROR: If ASYNCHRONOUS='YES' appears, UNIT=number must also appear
106 write(internal_file
, asynchronous
='yes')
108 !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
109 write(10, *, id
=id
) "Ok"
111 !ERROR: If ID appears, ASYNCHRONOUS='YES' must also appear
112 write(10, *, id
=id
, asynchronous
='no') "Ok"
114 !ERROR: If POS appears, REC must not appear
115 write(10, pos
=13, rec
=13) 'Ok'
117 !ERROR: If DECIMAL appears, FMT or NML must also appear
118 !ERROR: If ROUND appears, FMT or NML must also appear
119 !ERROR: If SIGN appears, FMT or NML must also appear
120 !ERROR: Invalid DECIMAL value 'Komma'
121 write(10, decimal
='Komma', sign
='plus', round
='down') jj
123 !ERROR: If DELIM appears, FMT=* or NML must also appear
124 !ERROR: Invalid DELIM value 'Nix'
125 write(delim
='Nix', fmt
='(A)', unit
=10) 'Ok'
127 !ERROR: ID kind (1) is smaller than default INTEGER kind (4)
128 write(id
=id1
, unit
=10, asynchronous
='Yes') 'Ok'
130 !ERROR: ID variable 'const_id' must be definable
131 write(10, *, asynchronous
='yes', id
=const_id
, iostat
=stat2
) 'Ok'
135 !ERROR: Output item must not be a procedure pointer
136 print*, n1
, procptr
, n2