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