diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/openmp.cc | 11 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/allocate-pinned-1.f90 | 16 |
2 files changed, 23 insertions, 4 deletions
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 9b30a10..333f0c7 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -7423,8 +7423,9 @@ resolve_omp_udr_clause (gfc_omp_namelist *n, gfc_namespace *ns, } /* Assume that a constant expression in the range 1 (omp_default_mem_alloc) - to 8 (omp_thread_mem_alloc) range is fine. The original symbol name is - already lost during matching via gfc_match_expr. */ + to 8 (omp_thread_mem_alloc) range, or 200 (ompx_gnu_pinned_mem_alloc) is + fine. The original symbol name is already lost during matching via + gfc_match_expr. */ static bool is_predefined_allocator (gfc_expr *expr) { @@ -7433,8 +7434,10 @@ is_predefined_allocator (gfc_expr *expr) && expr->ts.type == BT_INTEGER && expr->ts.kind == gfc_c_intptr_kind && expr->expr_type == EXPR_CONSTANT - && mpz_sgn (expr->value.integer) > 0 - && mpz_cmp_si (expr->value.integer, 8) <= 0); + && ((mpz_sgn (expr->value.integer) > 0 + && mpz_cmp_si (expr->value.integer, 8) <= 0) + || (mpz_cmp_si (expr->value.integer, 200) >= 0 + && mpz_cmp_si (expr->value.integer, 200) <= 0))); } /* Resolve declarative ALLOCATE statement. Note: Common block vars only appear diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-pinned-1.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-pinned-1.f90 new file mode 100644 index 0000000..0e6619b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/allocate-pinned-1.f90 @@ -0,0 +1,16 @@ +! Test that the ompx_gnu_pinned_mem_alloc is accepted by the parser + +module m +use iso_c_binding +integer, parameter :: omp_allocator_handle_kind = c_intptr_t + integer (kind=omp_allocator_handle_kind), & + parameter :: ompx_gnu_pinned_mem_alloc = 200 +end + +subroutine f () + use m + implicit none + ! The "Sorry" is here temporarily only to avoid excess error failures. + integer, save :: i ! { dg-error "Sorry, !.OMP allocate for variable 'i' at .1. with SAVE attribute not yet implemented" } + !$omp allocate(i) allocator(ompx_gnu_pinned_mem_alloc) +end |