1! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
2! REQUIRES: shell
3! OpenMP Version 5.0
4! 2.11.3 allocate Directive
5! The allocate directive must appear in the same scope as the declarations of
6! each of its list items and must follow all such declarations.
7
8subroutine allocate()
9use omp_lib
10  integer :: x
11  contains
12    subroutine sema()
13    integer :: a, b
14    real, dimension (:,:), allocatable :: darray
15
16    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATE directive appears
17    !$omp allocate(x)
18        print *, a
19
20    !ERROR: List items must be declared in the same scoping unit in which the ALLOCATE directive appears
21    !$omp allocate(x) allocator(omp_default_mem_alloc)
22      allocate ( darray(a, b) )
23    end subroutine sema
24
25end subroutine allocate
26