summaryrefslogtreecommitdiff
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.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 66669550499..42ecd0a9cbb 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -90,16 +90,13 @@ gfc_omp_check_optional_argument (tree decl, bool for_present_check)
if (!DECL_LANG_SPECIFIC (decl))
return NULL_TREE;
- bool is_array_type = false;
+ tree orig_decl = decl;
/* For assumed-shape arrays, a local decl with arg->data is used. */
if (TREE_CODE (decl) != PARM_DECL
&& (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))
|| GFC_ARRAY_TYPE_P (TREE_TYPE (decl))))
- {
- is_array_type = true;
- decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
- }
+ decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
if (decl == NULL_TREE
|| TREE_CODE (decl) != PARM_DECL
@@ -132,23 +129,8 @@ gfc_omp_check_optional_argument (tree decl, bool for_present_check)
return decl;
}
- tree cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
- decl, null_pointer_node);
-
- /* Fortran regards unallocated allocatables/disassociated pointer which
- are passed to a nonallocatable, nonpointer argument as not associated;
- cf. F2018, 15.5.2.12, Paragraph 1. */
- if (is_array_type)
- {
- tree cond2 = build_fold_indirect_ref_loc (input_location, decl);
- cond2 = gfc_conv_array_data (cond2);
- cond2 = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
- cond2, null_pointer_node);
- cond = fold_build2_loc (input_location, TRUTH_ANDIF_EXPR,
- boolean_type_node, cond, cond2);
- }
-
- return cond;
+ return fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ orig_decl, null_pointer_node);
}
@@ -1287,22 +1269,6 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
return;
tree orig_decl = decl;
- /* For nonallocatable, nonpointer arrays, a temporary variable is
- generated, but this one is only defined if the variable is present;
- hence, we now set it to NULL to avoid accessing undefined variables.
- We cannot use a temporary variable here as otherwise the replacement
- of the variables in omp-low.c will not work. */
- if (present && GFC_ARRAY_TYPE_P (TREE_TYPE (decl)))
- {
- tree tmp = fold_build2_loc (input_location, MODIFY_EXPR,
- void_type_node, decl, null_pointer_node);
- tree cond = fold_build1_loc (input_location, TRUTH_NOT_EXPR,
- boolean_type_node, present);
- tmp = build3_loc (input_location, COND_EXPR, void_type_node,
- cond, tmp, NULL_TREE);
- gimplify_and_add (tmp, pre_p);
- }
-
c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
OMP_CLAUSE_DECL (c4) = decl;