xref: /llvm-project/flang/test/Semantics/OpenMP/allocators05.f90 (revision cdbd22876b71acad9e5eeceadc0d8859e6e73b18)
1! REQUIRES: openmp_runtime
2
3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
4! OpenMP Version 5.2
5! Inherited from 2.11.3 allocate directive
6! allocate directives that appear in a target region must specify an
7! allocator clause unless a requires directive with the dynamic_allocators
8! clause is present in the same compilation unit.
9
10subroutine allocate()
11    use omp_lib
12
13    integer :: i
14    integer, allocatable :: a(:), b(:)
15    integer, parameter :: LEN = 2
16
17    !$omp target private(a, b)
18    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATORS directive appears
19    !$omp allocators allocate(omp_default_mem_alloc: a)
20        allocate(a(LEN))
21    !ERROR: ALLOCATORS directives that appear in a TARGET region must specify an allocator
22    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATORS directive appears
23    !$omp allocators allocate(b)
24        allocate(b(LEN))
25    !$omp end target
26end subroutine
27