> > -  if (stride)
> > +  if (stride && akind >= GFC_ARRAY_ALLOCATABLE)
> >      rtype = build_range_type (gfc_array_index_type, gfc_index_zero_node,
> >                               int_const_binop (MINUS_EXPR, stride,
> >                                                build_int_cst (TREE_TYPE 
> > (stride), 1)));
> > 
> > It does not seem to make sense to build range types for arrays where the
> > permitted value range is often above the upper bound.
> 
> Well, the ME explicitely allows domains with NULL TYPE_MAX_VALUE for this.
> In the above case TYPE_MIN_VALUE is zero so you can omit the domain but
> I believe that usually the FE communicates a lower bound of one to the ME.

I will give it a try to pass NULL here. Makes sense to me.  It seems the FE 
always 
compensates by hand and all arrays in array descriptor starts by 0.
> >    if (DECL_P (ref)
> > +      /* Be sure the size of MEM_REF target match.  For example:
> > +
> > +      char buf[10];
> > +      struct foo *str = (struct foo *)&buf;
> > +
> > +      str->trailin_array[2] = 1;
> > +
> > +    is valid because BUF allocate enough space.  */
> > +
> > +      && (!size || operand_equal_p (DECL_SIZE (ref), size, 0))
> 
> But it's still an array at struct end.  So I don't see how you
> can validly claim it is not.

It is because the predicate is a bit misnamed. It really check whether array is
possibly trailing array, i.e. we can not rely on the fact that all accesses are
within the specified domain.  The test I updated that looks for DECL simply 
assumes
that declarations can not be accessed past their end.
It would make more sense to use object size machinery here somehow.
(i.e. even in fortran we have accesses to mallocated buffers of constant size).
But this probably could be better handled at niter side where we can also deal 
with
case of real trailing arrays of known size.

Honza
> 
> Richard.
> 
> >        && !(flag_unconstrained_commons
> >        && TREE_CODE (ref) == VAR_DECL && DECL_COMMON (ref)))
> >      return false;
> > 
> > 
> 
> -- 
> Richard Biener <rguent...@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
> 21284 (AG Nuernberg)

Reply via email to