xref: /llvm-project/flang/test/Semantics/io07.f90 (revision eb77f442b342a1bb234254e05759933bad9dfab1)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
21001 format(A)
3
4     !ERROR: Format statement must be labeled
5     format(A)
6
72001 format(3I8, 3Z8)
82002 format(DC, F8.2, 3I8, Z8)
92003 format(  D C , F 8 . 2 , 3  I  8  ,  3  Z  8  )
102004 format(20PF10.2)
112005 format(20P,F10.2)
122006 format(20P7F10.2)
132007 format(1X/)
142008 format(/02x)
152009 format(1x/02x)
162010 format(2L2:)
172011 format(:2L2)
182012 format(2L2 : 2L2)
19
20     write(*,2013) 'Hello'
21     if (2+2.eq.4) then
222013   format(A10) ! ok to reference outside the if block
23     endif
24
25     ! C1302 warnings; no errors
26     !WARNING: Expected ',' or ')' in format expression
272051 format(1X3/)
28     !WARNING: Expected ',' or ')' in format expression
292052 format(1X003/)
30     !WARNING: Expected ',' or ')' in format expression
312053 format(3P7I2)
32     !WARNING: Expected ',' or ')' in format expression
332054 format(3PI2)
34
35     !ERROR: Expected ',' or ')' in format expression
362101 format(3I83Z8, 'abc')
37
38     !ERROR: Expected ',' or ')' in format expression
392102 format(  3  I  8  3  Z  8  )
40
41     !ERROR: Expected ',' or ')' in format expression
422103 format(3I8 3Z8)
43
44     !WARNING: Expected ',' or ')' in format expression
452104 format(3I8 Z8)
46
473001 format(*(I3))
483002 format(5X,*(2(A)))
49
50     !ERROR: Unlimited format item list must contain a data edit descriptor
51     !WARNING: 'X' edit descriptor must have a positive position value
523101 format(*(X))
53
54     !ERROR: Unlimited format item list must contain a data edit descriptor
553102 format(5X,*(2(/)))
56
57     !ERROR: Unlimited format item list must contain a data edit descriptor
583103 format(5X, 'abc', *((:)))
59
60     !WARNING: 'X' edit descriptor must have a positive position value
614001 format(2(X))
62
63     !ERROR: List repeat specifier must be positive
64     !WARNING: 'X' edit descriptor must have a positive position value
65     !ERROR: 'DT' edit descriptor repeat specifier must be positive
664101 format(0(X), 0dt)
67
686001 format(((I0, B0)))
69
70     !ERROR: 'A' edit descriptor 'w' value must be positive
71     !WARNING: 'L' edit descriptor 'w' value should be positive
726101 format((A0), ((L0)))
73
74     !WARNING: 'L' edit descriptor 'w' value should be positive
756102 format((3(((L 0 0 0)))))
76
777001 format(17G8.1, 17G8.1e3)
78
79     !ERROR: Expected 'G' edit descriptor '.d' value
807101 format(17G8)
81
828001 format(9G0.5)
83
84     !ERROR: A 'G0' edit descriptor must not have an 'e' value
858101 format(9(G0.5e1))
86
87     !ERROR: A 'G0' edit descriptor must not have an 'e' value
888102 format(9(G0.5  E 1))
89end
90