xref: /llvm-project/flang/test/Semantics/OpenMP/allocators01.f90 (revision cdbd22876b71acad9e5eeceadc0d8859e6e73b18)
1! REQUIRES: openmp_runtime
2
3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
4! OpenMP Version 5.2
5! 6.7 allocators construct
6! A list item that appears in an allocate clause must appear as
7! one of the variables that is allocated by the allocate-stmt in
8! the associated allocator structured block.
9
10subroutine allocate()
11use omp_lib
12
13  integer, allocatable :: arr1(:), arr2(:, :), arr3(:), arr4(:, :)
14
15  !$omp allocators allocate(arr3)
16    allocate(arr3(3), arr4(4, 4))
17  !$omp end allocators
18
19  !ERROR: Object 'arr1' in ALLOCATORS directive not found in corresponding ALLOCATE statement
20  !$omp allocators allocate(omp_default_mem_alloc: arr1, arr2)
21    allocate(arr2(2, 2))
22
23end subroutine allocate
24