153 lines · plain
1! RUN: bbc -pft-test -o %t %s | FileCheck %s2 3! Test structure of the Pre-FIR tree4 5! CHECK: Subroutine foo6subroutine foo()7 ! CHECK: <<DoConstruct>>8 ! CHECK: NonLabelDoStmt9 do i=1,510 ! CHECK: PrintStmt11 print *, "hey"12 ! CHECK: <<DoConstruct>>13 ! CHECK: NonLabelDoStmt14 do j=1,515 ! CHECK: PrintStmt16 print *, "hello", i, j17 ! CHECK: EndDoStmt18 end do19 ! CHECK: <<End DoConstruct>>20 ! CHECK: EndDoStmt21 end do22 ! CHECK: <<End DoConstruct>>23! CHECK: EndSubroutineStmt24end subroutine25! CHECK: End Subroutine foo26 27! CHECK: BlockData28block data29 integer, parameter :: n = 10030 integer, dimension(n) :: a, b, c31 common /arrays/ a, b, c32end33! CHECK: End BlockData34 35! CHECK: Module test_mod36module test_mod37interface38 ! check specification parts are not part of the PFT.39 ! CHECK-NOT: node40 module subroutine dump()41 end subroutine42end interface43 integer :: xdim44 real, allocatable :: pressure(:)45contains46 ! CHECK: Subroutine foo47 subroutine foo()48 ! CHECK: EndSubroutineStmt49 contains50 ! CHECK: Subroutine subfoo51 subroutine subfoo()52 ! CHECK: EndSubroutineStmt53 9 end subroutine54 ! CHECK: End Subroutine subfoo55 ! CHECK: Function subfoo256 function subfoo2()57 ! CHECK: EndFunctionStmt58 9 end function59 ! CHECK: End Function subfoo260 end subroutine61 ! CHECK: End Subroutine foo62 63 ! CHECK: Function foo264 function foo2(i, j)65 integer i, j, foo266 ! CHECK: AssignmentStmt67 foo2 = i + j68 ! CHECK: EndFunctionStmt69 contains70 ! CHECK: Subroutine subfoo71 subroutine subfoo()72 ! CHECK: EndSubroutineStmt73 end subroutine74 ! CHECK: End Subroutine subfoo75 end function76 ! CHECK: End Function foo277end module78! CHECK: End Module test_mod79 80! CHECK: Submodule test_mod_impl: submodule(test_mod) test_mod_impl81submodule (test_mod) test_mod_impl82contains83 ! CHECK: Subroutine foo84 subroutine foo()85 ! CHECK: EndSubroutineStmt86 contains87 ! CHECK: Subroutine subfoo88 subroutine subfoo()89 ! CHECK: EndSubroutineStmt90 end subroutine91 ! CHECK: End Subroutine subfoo92 ! CHECK: Function subfoo293 function subfoo2()94 ! CHECK: EndFunctionStmt95 end function96 ! CHECK: End Function subfoo297 end subroutine98 ! CHECK: End Subroutine foo99 ! CHECK: MpSubprogram dump100 module procedure dump101 ! CHECK: FormatStmt10211 format (2E16.4, I6)103 ! CHECK: <<IfConstruct>>104 ! CHECK: IfThenStmt105 if (xdim > 100) then106 ! CHECK: PrintStmt107 print *, "test: ", xdim108 ! CHECK: ElseStmt109 else110 ! CHECK: WriteStmt111 write (*, 11) "test: ", xdim, pressure112 ! CHECK: EndIfStmt113 end if114 ! CHECK: <<End IfConstruct>>115 end procedure116end submodule117! CHECK: End Submodule test_mod_impl118 119! CHECK: BlockData120block data named_block121 integer i, j, k122 common /indexes/ i, j, k123end124! CHECK: End BlockData125 126! CHECK: Function bar127function bar()128! CHECK: EndFunctionStmt129end function130! CHECK: End Function bar131 132! Test top level directives133!DIR$ INTEGER=64134! CHECK: CompilerDirective:135 136! Test nested directive137! CHECK: Subroutine test_directive138subroutine test_directive()139 !DIR$ INTEGER=64140 ! CHECK: CompilerDirective:141end subroutine142! CHECK: EndSubroutine143 144! CHECK: Program <anonymous>145 ! check specification parts are not part of the PFT.146 ! CHECK-NOT: node147 use test_mod148 real, allocatable :: x(:)149 ! CHECK: AllocateStmt150 allocate(x(foo2(10, 30)))151end152! CHECK: End Program153