1 ! RUN: bbc -pft-test -o %t %s | FileCheck %s
3 ! Test Pre-FIR Tree captures all the intended nodes from the parse-tree
4 ! Coarray and OpenMP related nodes are tested in other files.
6 ! CHECK: Program test_prog
8 ! Check specification part is not part of the tree.
11 integer, intent(inout
) :: i
15 real, allocatable
, target
:: x(:)
18 ! CHECK: <<DoConstruct>>
19 ! CHECK: NonLabelDoStmt
23 ! CHECK: <<DoConstruct>>
24 ! CHECK: NonLabelDoStmt
27 print *, "hello", i
, j
30 ! CHECK: <<End DoConstruct>>
33 ! CHECK: <<End DoConstruct>>
35 ! CHECK: <<AssociateConstruct>>
36 ! CHECK: AssociateStmt
37 associate (k
=> i
+ j
)
40 ! CHECK: EndAssociateStmt
42 ! CHECK: <<End AssociateConstruct>>
44 ! CHECK: <<BlockConstruct!>>
49 ! CHECK: PointerAssignmentStmt
51 ! CHECK: AssignmentStmt
53 ! CHECK: AssignmentStmt
55 ! CHECK: <<CaseConstruct!>>
56 ! CHECK: SelectCaseStmt
64 ! CHECK: <<IfConstruct>>
70 else if (p(1)==0.) then
79 ! CHECK: <<End IfConstruct>>
84 ! Note: label-do-loop are canonicalized into do constructs
85 ! CHECK: <<DoConstruct!>>
86 ! CHECK: NonLabelDoStmt
89 if (p(l
)<0.) p(l
)=cos(p(l
))
93 ! CHECK: <<End DoConstruct!>>
96 ! CHECK: EndSelectStmt
98 ! CHECK: <<End CaseConstruct!>>
101 ! CHECK: <<End BlockConstruct!>>
103 ! CHECK-NOT: WhereConstruct
105 where (x
> 1.) x
= x
/2.
107 ! CHECK: <<WhereConstruct>>
108 ! CHECK: WhereConstructStmt
110 ! CHECK: AssignmentStmt
112 ! CHECK: MaskedElsewhereStmt
114 ! CHECK: AssignmentStmt
116 ! CHECK: <<WhereConstruct>>
118 ! CHECK: AssignmentStmt
121 ! CHECK: <<End WhereConstruct>>
122 ! CHECK: ElsewhereStmt
124 ! CHECK: AssignmentStmt
126 ! CHECK: EndWhereStmt
128 ! CHECK: <<End WhereConstruct>>
130 ! CHECK-NOT: ForAllConstruct
132 forall (i
= 1:5) x(i
) = y(i
)
134 ! CHECK: <<ForallConstruct>>
135 ! CHECK: ForallConstructStmt
137 ! CHECK: AssignmentStmt
138 x(i
) = x(i
) + y(10*i
)
139 ! CHECK: EndForallStmt
141 ! CHECK: <<End ForallConstruct>>
143 ! CHECK: DeallocateStmt
149 !! When derived type processing is implemented, remove all instances of:
152 !![disable]type :: a_type
153 !![disable] integer :: x
155 !![disable]type, extends(a_type) :: b_type
156 !![disable] integer :: y
160 ! CHECK: CompilerDirective
166 ! CHECK: Function foo
170 ! CHECK: <<SelectRankConstruct!>>
171 ! CHECK: SelectRankStmt
173 ! CHECK: SelectRankCaseStmt
175 ! CHECK: AssignmentStmt
177 ! CHECK: SelectRankCaseStmt
179 ! CHECK: AssignmentStmt
181 ! CHECK: SelectRankCaseStmt
183 ! CHECK: AssignmentStmt
185 ! CHECK: SelectRankCaseStmt
187 ! CHECK: AssignmentStmt
189 ! CHECK: EndSelectStmt
191 ! CHECK: <<End SelectRankConstruct!>>
194 ! CHECK: Function bar
197 ! CHECK: <<SelectTypeConstruct!>>
198 ! CHECK: SelectTypeStmt
200 ! CHECK: TypeGuardStmt
202 ! CHECK: AssignmentStmt
204 !![disable]! COM: CHECK: TypeGuardStmt
205 !![disable]class is (a_type)
206 !![disable] ! COM: CHECK: AssignmentStmt
208 !![disable] ! COM: CHECK: ReturnStmt
210 ! CHECK: TypeGuardStmt
212 ! CHECK: AssignmentStmt
214 ! CHECK: EndSelectStmt
216 ! CHECK: <<End SelectTypeConstruct!>>
219 ! CHECK: Subroutine sub
222 ! CHECK: CompilerDirective
229 ! CHECK: Subroutine altreturn
230 subroutine altreturn(i
, j
, *, *)
231 ! CHECK: <<IfConstruct!>>
239 ! CHECK: <<End IfConstruct!>>
245 ! CHECK: Subroutine iostmts
246 subroutine iostmts(filename
, a
, b
, c
)
247 character(*) :: filename
249 logical :: file_is_opened
252 inquire(file
=filename
, opened
=file_is_opened
)
253 ! CHECK: <<IfConstruct>>
254 if (file_is_opened
) then
256 open(10, FILE
=filename
)
258 ! CHECK: <<End IfConstruct>>
263 ! CHECK-NOT: NamelistStmt
264 namelist /nlist
/ a
, b
, c
267 ! CHECK: BackspaceStmt
284 ! CHECK: Subroutine sub2
286 integer :: i
, j
, k
, l
289 ! CHECK: ContinueStmt
293 ! CHECK: ArithmeticIfStmt
298 ! FIXME: is name resolution on assigned goto broken/todo ?
299 ! WILLCHECK: AssignStmt
300 !55 assign 6 to label
301 ! WILLCHECK: AssignedGotoStmt
302 !66 go to label (5, 6)
304 ! CHECK: ComputedGotoStmt
305 go
to (5, 6), 1 + mod(i
, 2)
309 ! CHECK: <<DoConstruct!>>
311 ! CHECK: <<DoConstruct!>>
318 ! CHECK: <<End DoConstruct!>>
320 ! CHECK: <<End DoConstruct!>>
329 ! CHECK: Subroutine sub3
337 ! CHECK: Subroutine sub4