http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50269

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-01 
21:10:05 UTC ---
(In reply to comment #1)
> This allows the code to compile, but one then gets a segfault
> or the right answer depending on memory layout.  I think
> trans-expr.c(conv_isocbinding_procedure) needs to be updated
> as well, but don't know what needs to be done (yet).

It might be that it accesses the descriptor instead of desc.data.


> -                         if (args_sym->as->type == AS_ASSUMED_SHAPE)
> +                         if (args_sym->as->type == AS_ASSUMED_SHAPE
> +                             && args->expr->ref->u.ar.type != AR_ELEMENT)
>                             {
>                               gfc_error ("Assumed-shape array '%s' at %L "
>                                          "cannot be an argument to the "

I think one should use the opportunity to update it to Fortran 2008, which
allows also assumed/deferred-shape arrays - if they are contiguous:

F2008, 15.2.3.6 C LOC (X):

"Argument. X shall have either the POINTER or TARGET attribute. It shall not be
a coindexed object. It shall either be a variable with interoperable type and
kind type parameters, or be a scalar, nonpolymorphic variable with no length
type parameters. If it is allocatable, it shall be allocated. If it is a
pointer, it shall be associated. If it is an array, it shall be contiguous and
have nonzero size. It shall not be a zero-length string."


Note: It talks about "contiguous" and not "simply contiguous", which means that
it is not compile-time checkable (unless strides are used or a vector index). I
think there is also a coindexed check missing.


Fortran 2003 had in 15.1.2.5 C LOC (X):

"Argument. X shall either
 (1) have interoperable type and type parameters and be
   (a) a variable that has the TARGET attribute and is interoperable,
   (b) an allocated allocatable variable that has the TARGET attribute
       and is not an array of zero size, or
   (c) an associated scalar pointer, or
 (2) be a nonpolymorphic scalar, have no length type parameters, and be
   (a) a nonallocatable, nonpointer variable that has the TARGET attribute,
   (b) an allocated allocatable variable that has the TARGET attribute, or
   (c) an associated pointer."

Reply via email to