xref: /llvm-project/flang/test/Lower/pre-fir-tree09.f90 (revision 87374a8cffb6b6f589e8810a4d8502623e9d0268)
1! RUN: bbc -pft-test -o %t %s | FileCheck %s
2
3module mm
4  !dir$ some directive 1
5  type t
6    logical :: tag
7  contains
8    final :: fin
9  end type
10  !dir$ some directive 2
11
12contains
13  !dir$ some directive 3
14  subroutine fin(x)
15    type(t), intent(inout) :: x
16    x%tag =.true.
17    !dir$ some directive 4
18    call s1
19    call s2
20    print*, 'fin', x
21
22  contains
23    !dir$ some directive 5
24    subroutine s1
25      print*, 's1'
26      !dir$ some directive 6
27    end subroutine s1
28
29    !dir$ some directive 7
30    subroutine s2
31      !dir$ some directive 8
32      if (.true.) then
33        !dir$ some directive 9
34        print*, 's2'
35        !dir$ some directive 10
36      endif
37      !dir$ some directive 11
38    end subroutine s2
39    !dir$ some directive 12
40  end subroutine fin
41  !dir$ some directive 13
42end module mm
43!dir$ some directive 14
44
45end
46
47! CHECK:  Module mm: module mm
48! CHECK:    CompilerDirective: !some directive 1
49! CHECK:    CompilerDirective: !some directive 2
50
51! CHECK:  Contains
52! CHECK:  CompilerDirective: !some directive 3
53
54! CHECK:  Subroutine fin: subroutine fin(x)
55! CHECK:    AssignmentStmt: x%tag =.true.
56! CHECK:    CompilerDirective: !some directive 4
57! CHECK:    CallStmt: call s1
58! CHECK:    CallStmt: call s2
59! CHECK:    PrintStmt: print*, 'fin', x
60! CHECK:    EndSubroutineStmt: end subroutine fin
61
62! CHECK:  Contains
63! CHECK:  CompilerDirective: !some directive 5
64
65! CHECK:  Subroutine s1: subroutine s1
66! CHECK:    PrintStmt: print*, 's1'
67! CHECK:    CompilerDirective: !some directive 6
68! CHECK:    EndSubroutineStmt: end subroutine s1
69! CHECK:  End Subroutine s1
70
71! CHECK:  CompilerDirective: !some directive 7
72
73! CHECK:  Subroutine s2: subroutine s2
74! CHECK:    CompilerDirective: !some directive 8
75! CHECK:    <<IfConstruct>> -> 7
76! CHECK:      IfThenStmt -> 7: if(.true.) then
77! CHECK:      ^CompilerDirective: !some directive 9
78! CHECK:      PrintStmt: print*, 's2'
79! CHECK:      CompilerDirective: !some directive 10
80! CHECK:      EndIfStmt: endif
81! CHECK:    <<End IfConstruct>>
82! CHECK:    CompilerDirective: !some directive 11
83! CHECK:    EndSubroutineStmt: end subroutine s2
84! CHECK:  End Subroutine s2
85
86! CHECK:  CompilerDirective: !some directive 12
87
88! CHECK:  End Contains
89! CHECK:  End Subroutine fin
90
91! CHECK:  CompilerDirective: !some directive 13
92
93! CHECK:  End Contains
94! CHECK:  End Module mm
95
96! CHECK:  CompilerDirective: !some directive 14
97
98! CHECK:  Program <anonymous>
99! CHECK:    EndProgramStmt: end
100! CHECK:  End Program <anonymous>
101