This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/5, OpenACC] Support Fortran optional arguments in the firstprivate clause
On Fri, Jul 12, 2019 at 12:36:13PM +0100, Kwok Cheung Yeung wrote:
> --- a/gcc/omp-general.c
> +++ b/gcc/omp-general.c
> @@ -48,6 +48,20 @@ omp_find_clause (tree clauses, enum omp_clause_code kind)
> return NULL_TREE;
> }
>
> +/* Return true if DECL is a Fortran optional argument. */
> +
> +bool
> +omp_is_optional_argument (tree 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;
> +}
This should be done through a langhook.
Are really all PARM_DECLs wtih DECL_BY_REFERENCE and pointer type optional
arguments? I mean, POINTER_TYPE is used for a lot of cases.
Jakub