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)"
14 write(*,'(000p,10p,0p)')
18 write(*,'(5X,*(2X,I2))')
19 write(*,'(5X,*(2X,DT))')
21 write(*,'(*(DT"value"))')
22 write(*,'(*(DT(+1,0,-1)))')
23 write(*,'(*(DT"value"(+1,000,-1)))')
25 write(*,'(S,(RZ),2E10.3)')
35 write(*,'("""abc""")')
36 write(*,'("a""""bc", 2x)')
38 write(*,'(3Habc, 2X, 3X)')
39 write(*,'(987654321098765432X)')
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
47 write(*, '(-4P,E20.5,E15.5)')
50 ! C1302 warnings; no errors
55 !ERROR: Empty format expression
58 !ERROR: Empty format expression
59 write(*,"" // '' // "")
61 !ERROR: Format expression must have an initial '('
64 !ERROR: Unexpected '+' in format expression
67 !ERROR: Unexpected '-' in format expression
70 !ERROR: 'P' edit descriptor must have a scale factor
73 !ERROR: 'P' edit descriptor must have a scale factor
74 write(*,'(P7F' // '5.2)')
76 !ERROR: Unexpected integer constant
79 !ERROR: Unexpected ',' before ')' in format expression
82 !ERROR: Unexpected ',' in format expression
85 !ERROR: Unexpected ',' in format expression
86 !ERROR: Unexpected ',' before ')' in format expression
89 !ERROR: Unexpected ',' before ')' in format expression
92 !ERROR: Unexpected '*' in format expression
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
147 !ERROR: 'I' edit descriptor repeat specifier must be positive
150 !ERROR: List repeat specifier must be positive
153 !ERROR: List repeat specifier must be positive
156 !ERROR: List repeat specifier must be positive
157 !ERROR: 'I' edit descriptor repeat specifier must be positive
160 !ERROR: Kind parameter '_' character in format expression
163 !ERROR: Unexpected '+' in format expression
166 !ERROR: Unexpected '-' in format expression
169 !ERROR: Unexpected '-' in format expression
172 !ERROR: 'X' edit descriptor must have a positive position value
175 !ERROR: Unexpected 'Y' in format expression
178 !ERROR: Unexpected 'Y' in format expression
181 !ERROR: Unexpected 'M' in format expression
184 !ERROR: Unexpected 'R' in format expression
185 !ERROR: Unexpected 'R' in format expression
188 !ERROR: Unexpected '-' in format expression
189 !ERROR: Unexpected 'Y' in format expression
192 !ERROR: 'A' edit descriptor 'w' value must be positive
195 !ERROR: 'L' edit descriptor 'w' value must be positive
198 !ERROR: Expected 'G' edit descriptor '.d' value
201 !ERROR: A 'G0' edit descriptor must not have an 'e' value
204 !ERROR: A 'G0' edit descriptor must not have an 'e' value
207 !ERROR: Kind parameter '_' character in format expression
210 !ERROR: Kind parameter '_' character in format expression
213 !ERROR: 'T' edit descriptor must have a positive position value
216 !ERROR: 'T' edit descriptor must have a positive position value
217 !ERROR: Unterminated format expression
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
236 !ERROR: Unterminated format expression
239 !ERROR: Unterminated format expression
242 !ERROR: Unterminated format expression
245 !ERROR: Unexpected integer constant
248 !ERROR: Unexpected ',' before ')' in format expression
251 !ERROR: Unexpected ',' in format expression
254 !ERROR: Unexpected ',' before ')' in format expression
257 !ERROR: Unterminated format expression
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
271 !ERROR: 'TR' edit descriptor must have a positive position value
274 !ERROR: Kind parameter '_' character in format expression
277 !ERROR: Kind parameter '_' character in format expression
280 !ERROR: Unterminated string
281 !ERROR: Unterminated format expression
284 !ERROR: Unexpected '_' in format expression
287 !ERROR: Unexpected '@' in format expression
288 write(*,'(3Habc, 3@, X)')
290 !ERROR: Unterminated format expression
293 !ERROR: Unterminated 'H' edit descriptor
294 !ERROR: Unterminated format expression
297 !ERROR: Unterminated 'H' edit descriptor
298 !ERROR: Unterminated format expression
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
319 !ERROR: Positive scale factor k (from kP) and width d in a 'E' edit descriptor must satisfy 'k < d+2'
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)')