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