[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / io08.f90
blobf6038b471759f39e8a6991fca891ed53a18a5bf2
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 character(20), parameter :: kp_ok = "(4P,E20.5,E15.5)"
3 character(20), parameter :: kp_xx = "(4P,E20.5,E15.2)"
5 write(*,*)
6 write(*,'()')
7 write(*,'(A)')
8 write(*,'(2X:2X)')
9 write(*,'(2X/2X)')
10 write(*,'(3/2X)')
11 write(*,'(3PF5.2)')
12 write(*,'(+3PF5.2)')
13 write(*,'(-3PF5.2)')
14 write(*,'(000p,10p,0p)')
15 write(*,'(3P7D5.2)')
16 write(*,'(3P,7F5.2)')
17 write(*,'(2X,(i3))')
18 write(*,'(5X,*(2X,I2))')
19 write(*,'(5X,*(2X,DT))')
20 write(*,'(*(DT))')
21 write(*,'(*(DT"value"))')
22 write(*,'(*(DT(+1,0,-1)))')
23 write(*,'(*(DT"value"(+1,000,-1)))')
24 write(*,'(*(DT(0)))')
25 write(*,'(S,(RZ),2E10.3)')
26 write(*,'(7I2)')
27 write(*,'(07I02)')
28 write(*,'(07I02.01)')
29 write(*,'(07I02.02)')
30 write(*,'(I0)')
31 write(*,'(G4.2)')
32 write(*,'(G0.8)')
33 write(*,'(T3)')
34 write(*,'("abc")')
35 write(*,'("""abc""")')
36 write(*,'("a""""bc", 2x)')
37 write(*,'(3Habc)')
38 write(*,'(3Habc, 2X, 3X)')
39 write(*,'(987654321098765432X)')
40 write(*,'($)')
41 write(*,'(\)')
42 write(*,'(RZ,RU,RP,RN,RD,RC,SS,SP,S,3G15.3e2)')
43 write(*, '(' // achar( 9) // ')') ! horizontal tab
44 write(*, '(' // achar(11) // ')') ! vertical tab
45 write(*, '(' // achar(32) // ')') ! space
46 write(*, kp_ok)
47 write(*, '(-4P,E20.5,E15.5)')
48 write(*, '(D20.0)')
50 ! C1302 warnings; no errors
51 write(*,'(3P7I2)')
52 write(*,'(5X i3)')
53 write(*,'(XEN)')
55 !ERROR: Empty format expression
56 write(*,"")
58 !ERROR: Empty format expression
59 write(*,"" // '' // "")
61 !ERROR: Format expression must have an initial '('
62 write(*,'I3')
64 !ERROR: Unexpected '+' in format expression
65 write(*,'(+7I2)')
67 !ERROR: Unexpected '-' in format expression
68 write(*,'(-7I2)')
70 !ERROR: 'P' edit descriptor must have a scale factor
71 write(*,'(P7F5.2)')
73 !ERROR: 'P' edit descriptor must have a scale factor
74 write(*,'(P7F' // '5.2)')
76 !ERROR: Unexpected integer constant
77 write(*,'(X,3,3L4)')
79 !ERROR: Unexpected ',' before ')' in format expression
80 write(*,'(X,i3,)')
82 !ERROR: Unexpected ',' in format expression
83 write(*,'(X,i3,,)')
85 !ERROR: Unexpected ',' in format expression
86 !ERROR: Unexpected ',' before ')' in format expression
87 write(*,'(X,i3,,,)')
89 !ERROR: Unexpected ',' before ')' in format expression
90 write(*,'(X,(i3,))')
92 !ERROR: Unexpected '*' in format expression
93 write(*,'(*)')
95 !ERROR: Expected integer constant in 'DT' edit descriptor v-list
96 write(*,'(*(DT(+1,0,=1)))')
98 !ERROR: Expected integer constant in 'DT' edit descriptor v-list
99 write(*,'(DT(1,0,+))')
101 !ERROR: Expected integer constant in 'DT' edit descriptor v-list
102 write(*,'(DT(1,0,*))')
104 !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list
105 write(*,'(DT(1,0,2*))')
107 !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list
108 write(*,'(DT(1,0,2*,+,?))')
110 !ERROR: Expected integer constant in 'DT' edit descriptor v-list
111 !ERROR: Unterminated format expression
112 write(*,'(DT(1,0,*)')
114 !ERROR: Expected ',' or ')' in 'DT' edit descriptor v-list
115 !ERROR: Unterminated format expression
116 write(*,'(DT(1,0,2*,+,?)')
118 !ERROR: Unexpected '?' in format expression
119 !ERROR: Unexpected ',' in format expression
120 write(*,'(?,*(DT(+1,,1)))')
122 !ERROR: Repeat specifier before unlimited format item list
123 !ERROR: Unlimited format item list must contain a data edit descriptor
124 write(*,'(5X,3*(2(X)))')
126 !ERROR: Nested unlimited format item list
127 write(*,'(D12.2,(*(F10.2)))')
129 !ERROR: Unlimited format item list must contain a data edit descriptor
130 write(*,'(5X,*(2(X)))')
132 !ERROR: Character in format after unlimited format item list
133 write(*,'(*(Z5),*(2F20.3))')
135 !ERROR: Character in format after unlimited format item list
136 write(*,'(*(B5),*(2(I5)))')
138 !ERROR: Character in format after unlimited format item list
139 write(*,'(*(I5), D12.7)')
141 !ERROR: 'I' edit descriptor 'm' value is greater than 'w' value
142 write(*,'(07I02.0 3)')
144 !ERROR: 'Z' edit descriptor 'm' value is greater than 'w' value
145 write(*,'(07Z02.4)')
147 !ERROR: 'I' edit descriptor repeat specifier must be positive
148 write(*,'(0I2)')
150 !ERROR: List repeat specifier must be positive
151 write(*,'(0(I2))')
153 !ERROR: List repeat specifier must be positive
154 write(*,'(000(I2))')
156 !ERROR: List repeat specifier must be positive
157 !ERROR: 'I' edit descriptor repeat specifier must be positive
158 write(*,'(0(0I2))')
160 !ERROR: Kind parameter '_' character in format expression
161 write(*,'(5_4X)')
163 !ERROR: Unexpected '+' in format expression
164 write(*,'(I+3)')
166 !ERROR: Unexpected '-' in format expression
167 write(*,'(I-3)')
169 !ERROR: Unexpected '-' in format expression
170 write(*,'(I-3, X)')
172 !ERROR: 'X' edit descriptor must have a positive position value
173 write(*,'(0X)')
175 !ERROR: Unexpected 'Y' in format expression
176 write(*,'(XY)')
178 !ERROR: Unexpected 'Y' in format expression
179 write(*,'(XYM)')
181 !ERROR: Unexpected 'M' in format expression
182 write(*,'(MXY)')
184 !ERROR: Unexpected 'R' in format expression
185 !ERROR: Unexpected 'R' in format expression
186 write(*,"(RR, RV)")
188 !ERROR: Unexpected '-' in format expression
189 !ERROR: Unexpected 'Y' in format expression
190 write(*,'(I-3, XY)')
192 !ERROR: 'A' edit descriptor 'w' value must be positive
193 write(*,'(A0)')
195 !ERROR: 'L' edit descriptor 'w' value must be positive
196 write(*,'(L0)')
198 !ERROR: Expected 'G' edit descriptor '.d' value
199 write(*,'(G4)')
201 !ERROR: A 'G0' edit descriptor must not have an 'e' value
202 write(*,'(G0.8e)')
204 !ERROR: A 'G0' edit descriptor must not have an 'e' value
205 write(*,'(G0.8e2)')
207 !ERROR: Kind parameter '_' character in format expression
208 write(*,'(I5_4)')
210 !ERROR: Kind parameter '_' character in format expression
211 write(*,'(5_4P)')
213 !ERROR: 'T' edit descriptor must have a positive position value
214 write(*,'(T0)')
216 !ERROR: 'T' edit descriptor must have a positive position value
217 !ERROR: Unterminated format expression
218 write(*,'(T0')
220 !ERROR: 'TL' edit descriptor must have a positive position value
221 !ERROR: 'T' edit descriptor must have a positive position value
222 !ERROR: Expected 'EN' edit descriptor 'd' value after '.'
223 write(*,'(TL0,T0,EN12.)')
225 !ERROR: Expected 'EX' edit descriptor 'e' value after 'E'
226 write(*,'(EX12.3e2, EX12.3e)')
228 !ERROR: 'TL' edit descriptor must have a positive position value
229 !ERROR: 'T' edit descriptor must have a positive position value
230 !ERROR: Unterminated format expression
231 write(*,'(TL00,T000')
233 !ERROR: Unterminated format expression
234 write(*,'(')
236 !ERROR: Unterminated format expression
237 write(*,'(-')
239 !ERROR: Unterminated format expression
240 write(*,'(I3+')
242 !ERROR: Unterminated format expression
243 write(*,'(I3,-')
245 !ERROR: Unexpected integer constant
246 write(*,'(3)')
248 !ERROR: Unexpected ',' before ')' in format expression
249 write(*,'(3,)')
251 !ERROR: Unexpected ',' in format expression
252 write(*,'(,3)')
254 !ERROR: Unexpected ',' before ')' in format expression
255 write(*,'(,)')
257 !ERROR: Unterminated format expression
258 write(*,'(X')
260 !ERROR: Unterminated format expression
261 write(*,'(XX') ! C1302 warning is not an error
263 !ERROR: Unexpected '@' in format expression
264 !ERROR: Unexpected '#' in format expression
265 !ERROR: Unexpected '&' in format expression
266 write(*,'(@@, # ,&&& &&, ignore error 4)')
268 !ERROR: Repeat specifier before 'TR' edit descriptor
269 write(*,'(3TR0)')
271 !ERROR: 'TR' edit descriptor must have a positive position value
272 write(*,'(TR0)')
274 !ERROR: Kind parameter '_' character in format expression
275 write(*,'(3_4X)')
277 !ERROR: Kind parameter '_' character in format expression
278 write(*,'(1_"abc")')
280 !ERROR: Unterminated string
281 !ERROR: Unterminated format expression
282 write(*,'("abc)')
284 !ERROR: Unexpected '_' in format expression
285 write(*,'("abc"_1)')
287 !ERROR: Unexpected '@' in format expression
288 write(*,'(3Habc, 3@, X)')
290 !ERROR: Unterminated format expression
291 write(*,'(4Habc)')
293 !ERROR: Unterminated 'H' edit descriptor
294 !ERROR: Unterminated format expression
295 write(*,'(5Habc)')
297 !ERROR: Unterminated 'H' edit descriptor
298 !ERROR: Unterminated format expression
299 write(*,'(50Habc)')
301 !ERROR: Integer overflow in format expression
302 write(*,'(9876543210987654321X)')
304 !ERROR: Integer overflow in format expression
305 write(*,'(98765432109876543210X)')
307 !ERROR: Integer overflow in format expression
308 write(*,'(I98765432109876543210)')
310 !ERROR: Integer overflow in format expression
311 write(*,'(45I20.98765432109876543210, 45I20)')
313 !ERROR: Integer overflow in format expression
314 write(*,'(45' // ' I20.9876543' // '2109876543210, 45I20)')
316 !ERROR: Repeat specifier before '$' edit descriptor
317 write(*,'(7$)')
319 !ERROR: Positive scale factor k (from kP) and width d in a 'E' edit descriptor must satisfy 'k < d+2'
320 write(*, kp_xx)
322 !ERROR: Negative scale factor k (from kP) and width d in a 'E' edit descriptor must satisfy '-d < k'
323 write(*, '(-4P,E20.5,E15.2)')