This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR25099 - elemental subroutine argument conformance checking
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: THOMAS Paul Richard 169137 <paul dot richard dot thomas at cea dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, dominiq at lps dot ens dot fr, paulthomas2 at wanadoo dot fr
- Date: Fri, 21 Apr 2006 09:39:00 -0700
- Subject: Re: [Patch, fortran] PR25099 - elemental subroutine argument conformance checking
- References: <756DFD3DE8F1D411A59A00306E06E84705CBEFB6@drfccad.cad.cea.fr>
On Fri, Apr 21, 2006 at 06:13:57PM +0200, THOMAS Paul Richard 169137 wrote:
> 2006-04-21 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/25099
> * resolve.c (resolve_call): Check conformity of elemental
> subroutine actual arguments.
>
> 2006-04-21 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/25099
> * gfortran.dg/elemental_subroutine_4.f90: New test.
> * gfortran.dg/assumed_size_refs_1.f90: Add error to non-conforming
> call sub (m, x).
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (révision 113111)
+++ gcc/fortran/resolve.c (copie de travail)
@@ -1669,18 +1669,31 @@
gfc_internal_error ("resolve_subroutine(): bad function type");
}
+ /* Some checks of elemental subroutines. */
if (c->ext.actual != NULL
&& c->symtree->n.sym->attr.elemental)
{
gfc_actual_arglist * a;
- /* Being elemental, the last upper bound of an assumed size array
- argument must be present. */
+ gfc_expr * e;
+ e = NULL;
+
for (a = c->ext.actual; a; a = a->next)
{
+ /* The last upper bound of an assumed size array argument must
+ be present. */
if (a->expr != NULL
&& a->expr->rank > 0
&& resolve_assumed_size_actual (a->expr))
return FAILURE;
+
+ /* Array actual arguments must conform. */
+ if (e != NULL && a->expr->rank
Is the check on a->expr->rank actually needed here?
Doesn't the preceding if statement guarantee a->expr->rank
is validate?
+ && gfc_check_conformance ("elemental subroutine", a->expr, e)
+ == FAILURE)
+ return FAILURE;
+
+ if (e == NULL && a->expr->rank)
Likewise.
+ e = a->expr;
}
}
--
steve