[Patch, Fortran] Allow assumed-shape arrays with BIND(C) for TS29113
Mikael Morin
mikael.morin@sfr.fr
Fri Jul 20 09:57:00 GMT 2012
On 18/07/2012 17:17, Tobias Burnus wrote:
> This patch was written on top of the big assumed-shape patch.* However,
> it should also work by itself.
>
> Bootstrapped and regtested on x86-64-linux.
> OK for the trunk?
>
> Tobias
>
> * http://gcc.gnu.org/ml/fortran/2012-07/msg00052.html
> 2012-07-18 Tobias Burnus <burnus@net-b.de>
>
> * decl.c (gfc_verify_c_interop_param): Allow assumed-shape
> with -std=f2008ts.
>
> 2012-07-18 Tobias Burnus <burnus@net-b.de>
>
> * gfortran.dg/bind_c_array_params_2.f90: New.
> * gfortran.dg/bind_c_array_params.f03: Add -std=f2003
> and update dg-error.
>
> diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
> index 01693ad..4184608 100644
> --- a/gcc/fortran/decl.c
> +++ b/gcc/fortran/decl.c
> @@ -1092,29 +1096,15 @@ gfc_verify_c_interop_param (gfc_symbol *sym)
> retval = FAILURE;
>
> /* Make sure that if it has the dimension attribute, that it is
> - either assumed size or explicit shape. */
> - if (sym->as != NULL)
> - {
> - if (sym->as->type == AS_ASSUMED_SHAPE)
> - {
> - gfc_error ("Assumed-shape array '%s' at %L cannot be an "
> - "argument to the procedure '%s' at %L because "
> - "the procedure is BIND(C)", sym->name,
> - &(sym->declared_at), sym->ns->proc_name->name,
> - &(sym->ns->proc_name->declared_at));
> - retval = FAILURE;
> - }
> -
> - if (sym->as->type == AS_DEFERRED)
> - {
> - gfc_error ("Deferred-shape array '%s' at %L cannot be an "
> - "argument to the procedure '%s' at %L because "
> - "the procedure is BIND(C)", sym->name,
> - &(sym->declared_at), sym->ns->proc_name->name,
> - &(sym->ns->proc_name->declared_at));
> - retval = FAILURE;
> - }
> - }
> + either assumed size or explicit shape. Deferred shape is already
> + covered by the pointer/allocatable attribute. */
Don't we need to fix the pointer/allocatable diagnostics as well then?
> + if (sym->as != NULL && sym->as->type == AS_ASSUMED_SHAPE
> + && gfc_notify_std (GFC_STD_F2008_TS, "Assumed-shape array '%s' "
> + "at %L as dummy argument to the BIND(C) "
> + "procedure '%s' at %L", sym->name,
> + &(sym->declared_at), sym->ns->proc_name->name,
> + &(sym->ns->proc_name->declared_at)) == FAILURE)
> + retval = FAILURE;
> }
> }
>
More information about the Gcc-patches
mailing list