61 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree %s | FileCheck %s4! RUN: %flang_fc1 %openmp_flags -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"5! Ensures associated declarative OMP allocations are nested in their6! corresponding executable allocate directive7 8program allocate_tree9 use omp_lib10 integer, allocatable :: xarray(:), zarray(:, :)11 integer :: z, t, w12!$omp allocate(w) allocator(omp_const_mem_alloc)13 t = 214 z = 315!$omp allocate(xarray) allocator(omp_large_cap_mem_alloc)16!$omp allocate(zarray) allocator(omp_default_mem_alloc)17!$omp allocate18 allocate(xarray(4), zarray(t, z))19end program allocate_tree20 21!CHECK: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpAllocateDirective22!CHECK-NEXT: | OmpBeginDirective23!CHECK-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocate24!CHECK-NEXT: | | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'w'25!CHECK-NEXT: | | OmpClauseList -> OmpClause -> Allocator -> Scalar -> Integer -> Expr = '3_8'26!CHECK-NEXT: | | | Designator -> DataRef -> Name = 'omp_const_mem_alloc'27!CHECK-NEXT: | | Flags = {}28!CHECK-NEXT: | Block29 30!CHECK: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpAllocateDirective31!CHECK-NEXT: | OmpBeginDirective32!CHECK-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocate33!CHECK-NEXT: | | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'xarray'34!CHECK-NEXT: | | OmpClauseList -> OmpClause -> Allocator -> Scalar -> Integer -> Expr = '2_8'35!CHECK-NEXT: | | | Designator -> DataRef -> Name = 'omp_large_cap_mem_alloc'36!CHECK-NEXT: | | Flags = {}37!CHECK-NEXT: | Block38!CHECK-NEXT: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpAllocateDirective39!CHECK-NEXT: | | | OmpBeginDirective40!CHECK-NEXT: | | | | OmpDirectiveName -> llvm::omp::Directive = allocate41!CHECK-NEXT: | | | | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'zarray'42!CHECK-NEXT: | | | | OmpClauseList -> OmpClause -> Allocator -> Scalar -> Integer -> Expr = '1_8'43!CHECK-NEXT: | | | | | Designator -> DataRef -> Name = 'omp_default_mem_alloc'44!CHECK-NEXT: | | | | Flags = {}45!CHECK-NEXT: | | | Block46!CHECK-NEXT: | | | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpAllocateDirective47!CHECK-NEXT: | | | | | OmpBeginDirective48!CHECK-NEXT: | | | | | | OmpDirectiveName -> llvm::omp::Directive = allocate49!CHECK-NEXT: | | | | | | OmpClauseList ->50!CHECK-NEXT: | | | | | | Flags = {}51!CHECK-NEXT: | | | | | Block52!CHECK-NEXT: | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AllocateStmt53 54!UNPARSE: !$OMP ALLOCATE(w) ALLOCATOR(3_8)55!UNPARSE-NEXT: t=2_456!UNPARSE-NEXT: z=3_457!UNPARSE-NEXT: !$OMP ALLOCATE(xarray) ALLOCATOR(2_8)58!UNPARSE-NEXT: !$OMP ALLOCATE(zarray) ALLOCATOR(1_8)59!UNPARSE-NEXT: !$OMP ALLOCATE60!UNPARSE-NEXT: ALLOCATE(xarray(4_4), zarray(t,z))61