[Patch, fortran] PR25029 - Assumed size array can be associated with array pointer without upper bound of last dimension

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sun Dec 18 13:30:00 GMT 2005


:REVIEWMAIL:

Paul Thomas wrote:
> + /* Check references to assumed size arrays.  The flag need_full_assumed_size
> +    is zero when matching actual arguments.  */
> + 
> + static int need_full_assumed_size = 1;
> + 
> + static int
> + check_assumed_size_reference (gfc_symbol * sym, gfc_expr * e)
> + {
> +   if (need_full_assumed_size && sym->as && sym->as->type == AS_ASSUMED_SIZE)
> +     {

I'd prefer if you returned early if the condition is not matched, i.e.
   if (!need_full_assumed_size
       || !sym->as || !sym->as->type == AS_ASSUMED_SIZE)
      return 0;

> +       gfc_ref * ref;
> +       int dim = 0;

This initialization is superfluous.

> +       int last = 1;
> +       for (ref = e->ref; ref; ref = ref->next)
> + 	if (ref->type == REF_ARRAY)
> + 	  for (dim = 0;dim < ref->u.ar.as->rank; dim++)
                       ^ need blank
> + 	    last = ref->u.ar.type == DIMEN_ELEMENT && ref->u.ar.end[dim] == NULL;

Are you sure that you got the operator precedences right?  I'd prefer if you
put the subexpressions into parentheses.

Otherwise this is ok.

- Tobi



More information about the Gcc-patches mailing list