diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2024-03-13 09:35:28 +0100 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2024-03-13 09:35:28 +0100 |
commit | c5037fcee2de438774466e78e46e6ab4df72a7fe (patch) | |
tree | 142d566a17a5cbe424db989221b5d204fdd50f11 /gcc | |
parent | 6586359e8e4c611dd96129b5d4f24023949ac3fc (diff) | |
download | gcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.zip gcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.tar.gz gcc-c5037fcee2de438774466e78e46e6ab4df72a7fe.tar.bz2 |
OpenMP/Fortran: Fix defaultmap(none) issue with dummy procedures [PR114283]
Dummy procedures look similar to variables but aren't - neither in Fortran
nor in OpenMP. As the middle end sees PARM_DECLs, mark them as predetermined
firstprivate for mapping (as already done in gfc_omp_predetermined_sharing).
This does not address the isses related to procedure pointers, which are
still discussed on spec level [see PR].
PR fortran/114283
gcc/fortran/ChangeLog:
* trans-openmp.cc (gfc_omp_predetermined_mapping): Map dummy
procedures as firstprivate.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/declare-target-indirect-4.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/trans-openmp.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index a2bf156..1dba471 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -343,6 +343,15 @@ gfc_omp_predetermined_mapping (tree decl) && GFC_DECL_SAVED_DESCRIPTOR (decl))) return OMP_CLAUSE_DEFAULTMAP_TO; + /* Dummy procedures aren't considered variables by OpenMP, thus are + disallowed in OpenMP clauses. They are represented as PARM_DECLs + in the middle-end, so return OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE here + to avoid complaining about their uses with defaultmap(none). */ + if (TREE_CODE (decl) == PARM_DECL + && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == FUNCTION_TYPE) + return OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE; + /* These are either array or derived parameters, or vtables. */ if (VAR_P (decl) && TREE_READONLY (decl) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) |