44 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=514! OpenMP Version 5.15! 2.11.3 allocate Directive6! If list items within the ALLOCATE directive have the SAVE attribute, are a7! common block name, then only predefined memory allocator parameters can be8! used in the allocator clause9 10module AllocateModule11 INTEGER :: z12end module13 14subroutine allocate(custom_allocator)15use omp_lib16use AllocateModule17 integer, SAVE :: x18 integer :: w19 COMMON /CommonName/ y20 21 integer(kind=omp_allocator_handle_kind) :: custom_allocator22 23 !$omp allocate(x) allocator(omp_default_mem_alloc)24 !ERROR: A variable that is part of a common block may not be specified as a list item in an ALLOCATE directive, except implicitly via the named common block25 !$omp allocate(y) allocator(omp_default_mem_alloc)26 !ERROR: A list item on a declarative ALLOCATE must be declared in the same scope in which the directive appears27 !$omp allocate(z) allocator(omp_default_mem_alloc)28 29 !ERROR: If a list item is a named common block or has SAVE attribute, an ALLOCATOR clause must be present with a predefined allocator30 !$omp allocate(x)31 !ERROR: A variable that is part of a common block may not be specified as a list item in an ALLOCATE directive, except implicitly via the named common block32 !$omp allocate(y)33 !ERROR: A list item on a declarative ALLOCATE must be declared in the same scope in which the directive appears34 !$omp allocate(z)35 36 !$omp allocate(w) allocator(custom_allocator)37 38 !$omp allocate(x) allocator(custom_allocator)39 !ERROR: A variable that is part of a common block may not be specified as a list item in an ALLOCATE directive, except implicitly via the named common block40 !$omp allocate(y) allocator(custom_allocator)41 !ERROR: A list item on a declarative ALLOCATE must be declared in the same scope in which the directive appears42 !$omp allocate(z) allocator(custom_allocator)43end subroutine allocate44