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.
24 lines
747 B
Fortran
24 lines
747 B
Fortran
! REQUIRES: openmp_runtime
|
|
|
|
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
|
|
! OpenMP Version 5.2
|
|
! 6.7 allocators construct
|
|
! A list item that appears in an allocate clause must appear as
|
|
! one of the variables that is allocated by the allocate-stmt in
|
|
! the associated allocator structured block.
|
|
|
|
subroutine allocate()
|
|
use omp_lib
|
|
|
|
integer, allocatable :: arr1(:), arr2(:, :), arr3(:), arr4(:, :)
|
|
|
|
!$omp allocators allocate(arr3)
|
|
allocate(arr3(3), arr4(4, 4))
|
|
!$omp end allocators
|
|
|
|
!ERROR: A list item in an ALLOCATORS construct must be specified on the associated ALLOCATE statement
|
|
!$omp allocators allocate(omp_default_mem_alloc: arr1, arr2)
|
|
allocate(arr2(2, 2))
|
|
|
|
end subroutine allocate
|