Krzysztof Parzyszek ab049891cd
[flang][OpenMP] Reorganize ALLOCATE-related semantic checks (#165719)
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.
2025-11-03 06:58:59 -06:00

28 lines
633 B
Fortran

!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52
subroutine f00
implicit none
integer, allocatable :: a(:)
!$omp allocators allocate(a)
!ERROR: The body of an ALLOCATORS construct should be an ALLOCATE statement
continue
end
subroutine f01
implicit none
integer, allocatable :: a(:)
!ERROR: The body of an ALLOCATORS construct should be an ALLOCATE statement
!$omp allocators allocate(a)
!$omp end allocators
end
subroutine f02
implicit none
integer, allocatable :: a(:)
!ERROR: The body of an ALLOCATORS construct should be an ALLOCATE statement
!$omp allocators allocate(a)
end