aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-10-10 13:08:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-10-10 13:08:37 +0200
commit18cda88d873b67cfa06ac2a9c8b2e85468a73f4c (patch)
tree04f2252e785647862f9851e5481a7c9c979024eb /gcc/fortran/trans-openmp.c
parent81231d139c7bb882fe12b6e1948d34c8b1e9daf0 (diff)
downloadgcc-18cda88d873b67cfa06ac2a9c8b2e85468a73f4c.zip
gcc-18cda88d873b67cfa06ac2a9c8b2e85468a73f4c.tar.gz
gcc-18cda88d873b67cfa06ac2a9c8b2e85468a73f4c.tar.bz2
re PR fortran/59488 ([OpenMP] named constant in parallel construct leads to "not specified in enclosing parallel" error.)
PR fortran/59488 * trans-openmp.c (gfc_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for parameters or vtables. * gfortran.dg/gomp/pr59488-1.f90: New test. * gfortran.dg/gomp/pr59488-2.f90: New test. From-SVN: r216067
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r--gcc/fortran/trans-openmp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index c8028ab..038c3e9 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -135,6 +135,16 @@ gfc_omp_predetermined_sharing (tree decl)
if (GFC_DECL_RESULT (decl) && ! DECL_HAS_VALUE_EXPR_P (decl))
return OMP_CLAUSE_DEFAULT_SHARED;
+ /* These are either array or derived parameters, or vtables.
+ In the former cases, the OpenMP standard doesn't consider them to be
+ variables at all (they can't be redefined), but they can nevertheless appear
+ in parallel/task regions and for default(none) purposes treat them as shared.
+ For vtables likely the same handling is desirable. */
+ if (TREE_CODE (decl) == VAR_DECL
+ && TREE_READONLY (decl)
+ && TREE_STATIC (decl))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}