xref: /llvm-project/flang/test/Semantics/OpenMP/allocators05.f90 (revision cdbd22876b71acad9e5eeceadc0d8859e6e73b18)
1fb5fd2d8SMichael Klemm! REQUIRES: openmp_runtime
2fb5fd2d8SMichael Klemm
3*cdbd2287SKrzysztof Parzyszek! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
47f0d54b4SEthan Luis McDonough! OpenMP Version 5.2
57f0d54b4SEthan Luis McDonough! Inherited from 2.11.3 allocate directive
67f0d54b4SEthan Luis McDonough! allocate directives that appear in a target region must specify an
77f0d54b4SEthan Luis McDonough! allocator clause unless a requires directive with the dynamic_allocators
87f0d54b4SEthan Luis McDonough! clause is present in the same compilation unit.
97f0d54b4SEthan Luis McDonough
107f0d54b4SEthan Luis McDonoughsubroutine allocate()
117f0d54b4SEthan Luis McDonough    use omp_lib
127f0d54b4SEthan Luis McDonough
137f0d54b4SEthan Luis McDonough    integer :: i
147f0d54b4SEthan Luis McDonough    integer, allocatable :: a(:), b(:)
157f0d54b4SEthan Luis McDonough    integer, parameter :: LEN = 2
167f0d54b4SEthan Luis McDonough
177f0d54b4SEthan Luis McDonough    !$omp target private(a, b)
187f0d54b4SEthan Luis McDonough    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATORS directive appears
197f0d54b4SEthan Luis McDonough    !$omp allocators allocate(omp_default_mem_alloc: a)
207f0d54b4SEthan Luis McDonough        allocate(a(LEN))
217f0d54b4SEthan Luis McDonough    !ERROR: ALLOCATORS directives that appear in a TARGET region must specify an allocator
227f0d54b4SEthan Luis McDonough    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATORS directive appears
237f0d54b4SEthan Luis McDonough    !$omp allocators allocate(b)
247f0d54b4SEthan Luis McDonough        allocate(b(LEN))
257f0d54b4SEthan Luis McDonough    !$omp end target
267f0d54b4SEthan Luis McDonoughend subroutine
27