From e9b34037cdd196ab912a7ac3358f8a8d3e307e92 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 22 Feb 2021 13:20:26 +0100 Subject: Fortran/OpenMP: Fix optional dummy procedures [PR99171] gcc/fortran/ChangeLog: PR fortran/99171 * trans-openmp.c (gfc_omp_is_optional_argument): Regard optional dummy procs as nonoptional as no special treatment is needed. libgomp/ChangeLog: PR fortran/99171 * testsuite/libgomp.fortran/dummy-procs-1.f90: New test. --- gcc/fortran/trans-openmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/trans-openmp.c') diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 67e370f..349df1c 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -64,7 +64,9 @@ gfc_omp_is_allocatable_or_ptr (const_tree decl) /* True if the argument is an optional argument; except that false is also returned for arguments with the value attribute (nonpointers) and for assumed-shape variables (decl is a local variable containing arg->data). - Note that pvoid_type_node is for 'type(c_ptr), value. */ + Note that for 'procedure(), optional' the value false is used as that's + always a pointer and no additional indirection is used. + Note that pvoid_type_node is for 'type(c_ptr), value' (and c_funloc). */ static bool gfc_omp_is_optional_argument (const_tree decl) @@ -73,6 +75,7 @@ gfc_omp_is_optional_argument (const_tree decl) && DECL_LANG_SPECIFIC (decl) && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))) + && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != FUNCTION_TYPE && GFC_DECL_OPTIONAL_ARGUMENT (decl)); } -- cgit v1.1