[patch,gfortran] PR 22273: LEN() of INTENT(OUT) dummy

Erik Edelmann erik.edelmann@iki.fi
Fri Oct 14 11:04:00 GMT 2005


On Fri, Oct 14, 2005 at 01:52:01PM +0300, Erik Edelmann wrote:
> On Fri, Oct 14, 2005 at 12:12:46PM +0200, Tobias Schlüter wrote:
> > Erik Edelmann wrote:
> > > Is there any reason why the len() intrinsic is excluded from the
> > > inquiry function list in expr.c/check_inquiry()?  By including it
> > > (see attached patch) we would fix PR 22273.
> > 
> > There are only two reasons I can think of: either to raise awareness of the
> > FIXME comment :) or because this code was originally only intended for numeric
> > inquiry functions, as their value can always be evaluated at compile time.
> > But since we also allow array inquiry functions (lbound etc.), I think this is
> > ok, once you update the comment further down in check_inquiry.
> 
> Ok, here's an updated patch with fixed comment (I removed the
> word 'numeric', and reformatted it).  Please commit if OK.
> 
> 
>         Erik
> 
> 
> 2005-10-14  Erik Edelmann  <erik.edelmann@iki.fi>
> 
>         PR 22273
>         * expr.c (check_inquiry): Add "len" to inquiry_function
>           and update comment.

Damn. Of course I forgot to attach the patch.


        Erik
-------------- next part --------------
Index: gcc/fortran/expr.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/expr.c,v
retrieving revision 1.29
diff -u -p -r1.29 expr.c
--- gcc/fortran/expr.c	17 Sep 2005 18:57:59 -0000	1.29
+++ gcc/fortran/expr.c	14 Oct 2005 10:21:43 -0000
@@ -1355,7 +1355,7 @@ check_inquiry (gfc_expr * e)
   /* FIXME: This should be moved into the intrinsic definitions,
      to eliminate this ugly hack.  */
   static const char * const inquiry_function[] = {
-    "digits", "epsilon", "huge", "kind", "maxexponent", "minexponent",
+    "digits", "epsilon", "huge", "kind", "len", "maxexponent", "minexponent",
     "precision", "radix", "range", "tiny", "bit_size", "size", "shape",
     "lbound", "ubound", NULL
   };
@@ -1376,10 +1376,9 @@ check_inquiry (gfc_expr * e)
   if (e == NULL || e->expr_type != EXPR_VARIABLE)
     return FAILURE;
 
-  /* At this point we have a numeric inquiry function with a variable
-     argument.  The type of the variable might be undefined, but we
-     need it now, because the arguments of these functions are allowed
-     to be undefined.  */
+  /* At this point we have a inquiry function with a variable argument.  The
+     type of the variable might be undefined, but we need it now, because the
+     arguments of these functions are allowed to be undefined.  */
 
   if (e->ts.type == BT_UNKNOWN)
     {


More information about the Fortran mailing list