For ALLOCATORS and executable ALLOCATE first perform list item checks in the context of an individual ALLOCATE clause or directive respectively, then perform "global" checks, e.g. whether all list items are present on the ALLOCATE statement. These changes allowed to simplify the checks for presence on ALLOCATE statement and the use of a predefined allocator. Additionally, allow variable list item lists to be empty, add a test for the related spec restriction. This is a first step towards unifying OpenMPDeclarativeAllocate and OpenMPExecutableAllocate into a single directive.
25 lines
833 B
Fortran
25 lines
833 B
Fortran
! REQUIRES: openmp_runtime
|
|
|
|
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
|
|
! OpenMP Version 5.2
|
|
! Inherited from 2.11.3 allocate directive
|
|
! allocate directives that appear in a target region must specify an
|
|
! allocator clause unless a requires directive with the dynamic_allocators
|
|
! clause is present in the same compilation unit.
|
|
|
|
subroutine allocate()
|
|
use omp_lib
|
|
|
|
integer :: i
|
|
integer, allocatable :: a(:), b(:)
|
|
integer, parameter :: LEN = 2
|
|
|
|
!$omp target private(a, b)
|
|
!$omp allocators allocate(omp_default_mem_alloc: a)
|
|
allocate(a(LEN))
|
|
!ERROR: An ALLOCATE clause in a TARGET region must specify an allocator or REQUIRES(DYNAMIC_ALLOCATORS) must be specified
|
|
!$omp allocators allocate(b)
|
|
allocate(b(LEN))
|
|
!$omp end target
|
|
end subroutine
|