aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r--gcc/fortran/trans-openmp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index b4c77ae..88ecc33 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -47,6 +47,15 @@ along with GCC; see the file COPYING3. If not see
int ompws_flags;
+/* True if OpenMP should treat this DECL as an optional argument. */
+
+bool
+gfc_omp_is_optional_argument (const_tree decl)
+{
+ return (TREE_CODE (decl) == PARM_DECL && DECL_LANG_SPECIFIC (decl)
+ && GFC_DECL_OPTIONAL_ARGUMENT (decl));
+}
+
/* True if OpenMP should privatize what this DECL points to rather
than the DECL itself. */
@@ -59,6 +68,10 @@ gfc_omp_privatize_by_reference (const_tree decl)
&& (!DECL_ARTIFICIAL (decl) || TREE_CODE (decl) == PARM_DECL))
return true;
+ if (TREE_CODE (type) == POINTER_TYPE
+ && gfc_omp_is_optional_argument (decl))
+ return true;
+
if (TREE_CODE (type) == POINTER_TYPE)
{
/* Array POINTER/ALLOCATABLE have aggregate types, all user variables