Hi,
This adds an extra check in omp_is_optional_argument to confirm that
Fortran is being used, to guard against it accidently matching against
some other case in another language.
This will be committed to openacc-gcc-8-branch shortly.
Kwok
gcc/
* omp-general.c (omp_is_optional_argument): Add comment. Add extra
check for Fortran language.
Reviewed-by: Julian Brown <jul...@codesourcery.com>
---
gcc/ChangeLog.openacc | 5 +++++
gcc/omp-general.c | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 783ba6c..5104eaa 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-01-31 Kwok Cheung Yeung <k...@codesourcery.com>
+
+ * omp-general.c (omp_is_optional_argument): Add comment. Add extra
+ check for Fortran language.
+
2019-01-31 Julian Brown <jul...@codesourcery.com>
* gimplify.c (gimplify_scan_omp_clauses): Handle array sections on
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index dd37c46..8e37cfc 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -51,7 +51,12 @@ omp_find_clause (tree clauses, enum omp_clause_code kind)
bool
omp_is_optional_argument (tree decl)
{
- return TREE_CODE (decl) == PARM_DECL && DECL_BY_REFERENCE (decl)
+ /* A passed-by-reference Fortran optional argument is similar to
+ a normal argument, but since it can be null the type is a
+ POINTER_TYPE rather than a REFERENCE_TYPE. */
+ return lang_GNU_Fortran ()
+ && TREE_CODE (decl) == PARM_DECL
+ && DECL_BY_REFERENCE (decl)
&& TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE;
}
--
2.8.1