diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-05-13 14:02:50 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-05-13 14:02:50 +0200 |
commit | 2b45bf2152099996118ac8903d22718963cf1e99 (patch) | |
tree | 968dcddb045fa5a13f020becad9a9ef77f7d4942 /gcc/fortran | |
parent | 78c7cabba9ba2bd3b371fc6e4aa07896869d2b03 (diff) | |
download | gcc-2b45bf2152099996118ac8903d22718963cf1e99.zip gcc-2b45bf2152099996118ac8903d22718963cf1e99.tar.gz gcc-2b45bf2152099996118ac8903d22718963cf1e99.tar.bz2 |
re PR fortran/44036 (I can't declare an external function in an OMP shared statement.)
PR fortran/44036
* openmp.c (resolve_omp_clauses): Allow procedure pointers in clause
variable lists.
* trans-openmp.c (gfc_omp_privatize_by_reference): Don't privatize
by reference dummy procedures or non-dummy procedure pointers.
(gfc_omp_predetermined_sharing): Return
OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for dummy procedures.
* gfortran.dg/gomp/pr44036-1.f90: New test.
* gfortran.dg/gomp/pr44036-2.f90: New test.
* gfortran.dg/gomp/pr44036-3.f90: New test.
From-SVN: r159361
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 15 |
3 files changed, 25 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 86a9574..2eb730b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2010-05-13 Jakub Jelinek <jakub@redhat.com> + + PR fortran/44036 + * openmp.c (resolve_omp_clauses): Allow procedure pointers in clause + variable lists. + * trans-openmp.c (gfc_omp_privatize_by_reference): Don't privatize + by reference dummy procedures or non-dummy procedure pointers. + (gfc_omp_predetermined_sharing): Return + OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for dummy procedures. + 2010-05-11 Daniel Franke <franke.daniel@gmail.com> PR fortran/43711 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index bbf7e5a..4e96521 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -837,6 +837,8 @@ resolve_omp_clauses (gfc_code *code) if (el) continue; } + if (n->sym->attr.proc_pointer) + continue; } gfc_error ("Object '%s' is not a variable at %L", n->sym->name, &code->loc); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 016c5cf..f2e550a 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1,5 +1,6 @@ /* OpenMP directive translation -- generate GCC trees from gfc_code. - Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. Contributed by Jakub Jelinek <jakub@redhat.com> This file is part of GCC. @@ -57,7 +58,8 @@ gfc_omp_privatize_by_reference (const_tree decl) if (GFC_POINTER_TYPE_P (type)) return false; - if (!DECL_ARTIFICIAL (decl)) + if (!DECL_ARTIFICIAL (decl) + && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE) return true; /* Some arrays are expanded as DECL_ARTIFICIAL pointers @@ -96,6 +98,15 @@ gfc_omp_predetermined_sharing (tree decl) == NULL) return OMP_CLAUSE_DEFAULT_SHARED; + /* 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_DEFAULT_FIRSTPRIVATE here + to avoid complaining about their uses with default(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_DEFAULT_FIRSTPRIVATE; + /* COMMON and EQUIVALENCE decls are shared. They are only referenced through DECL_VALUE_EXPR of the variables contained in them. If those are privatized, they will not be |