pre-fir-tree01.f90
2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only %s | FileCheck %s
! Test structure of the Pre-FIR tree
! CHECK: Subroutine foo
subroutine foo()
! CHECK: <<DoConstruct>>
! CHECK: NonLabelDoStmt
do i=1,5
! CHECK: PrintStmt
print *, "hey"
! CHECK: <<DoConstruct>>
! CHECK: NonLabelDoStmt
do j=1,5
! CHECK: PrintStmt
print *, "hello", i, j
! CHECK: EndDoStmt
end do
! CHECK: <<End DoConstruct>>
! CHECK: EndDoStmt
end do
! CHECK: <<End DoConstruct>>
end subroutine
! CHECK: EndSubroutine foo
! CHECK: BlockData
block data
integer, parameter :: n = 100
integer, dimension(n) :: a, b, c
common /arrays/ a, b, c
end
! CHECK: EndBlockData
! CHECK: ModuleLike
module test_mod
interface
! check specification parts are not part of the PFT.
! CHECK-NOT: node
module subroutine dump()
end subroutine
end interface
integer :: xdim
real, allocatable :: pressure(:)
contains
! CHECK: Subroutine foo
subroutine foo()
contains
! CHECK: Subroutine subfoo
subroutine subfoo()
end subroutine
! CHECK: EndSubroutine subfoo
! CHECK: Function subfoo2
function subfoo2()
end function
! CHECK: EndFunction subfoo2
end subroutine
! CHECK: EndSubroutine foo
! CHECK: Function foo2
function foo2(i, j)
integer i, j, foo2
! CHECK: AssignmentStmt
foo2 = i + j
contains
! CHECK: Subroutine subfoo
subroutine subfoo()
end subroutine
! CHECK: EndSubroutine subfoo
end function
! CHECK: EndFunction foo2
end module
! CHECK: EndModuleLike
! CHECK: ModuleLike
submodule (test_mod) test_mod_impl
contains
! CHECK: Subroutine foo
subroutine foo()
contains
! CHECK: Subroutine subfoo
subroutine subfoo()
end subroutine
! CHECK: EndSubroutine subfoo
! CHECK: Function subfoo2
function subfoo2()
end function
! CHECK: EndFunction subfoo2
end subroutine
! CHECK: EndSubroutine foo
! CHECK: MpSubprogram dump
module procedure dump
! CHECK: FormatStmt
11 format (2E16.4, I6)
! CHECK: <<IfConstruct>>
! CHECK: IfThenStmt
if (xdim > 100) then
! CHECK: PrintStmt
print *, "test: ", xdim
! CHECK: ElseStmt
else
! CHECK: WriteStmt
write (*, 11) "test: ", xdim, pressure
! CHECK: EndIfStmt
end if
! CHECK: <<End IfConstruct>>
end procedure
end submodule
! CHECK: EndModuleLike
! CHECK: BlockData
block data named_block
integer i, j, k
common /indexes/ i, j, k
end
! CHECK: EndBlockData
! CHECK: Function bar
function bar()
end function
! CHECK: EndFunction bar
! CHECK: Program <anonymous>
! check specification parts are not part of the PFT.
! CHECK-NOT: node
use test_mod
real, allocatable :: x(:)
! CHECK: AllocateStmt
allocate(x(foo2(10, 30)))
end
! CHECK: EndProgram