(j3.2006) Should Fortran processor handle the contiguity of an assumed-length assumed-size/explicit-shape dummy argument of a bind(c) procedure?

Daniel C Chen cdchen
Wed Oct 8 11:30:21 EDT 2014


Please consider the following Fortran procedure,

  subroutine sub(arg1, arg2) bind(c)
    character(*) :: arg1(*)
    character(*) :: arg2(2,3)
  end subroutine

TS29113 specifies that both arg1 and arg2 correspond to a CFI descriptor as
they are assumed-length. However, I couldn't find words in the standard or
TS that explicitly specifies if Fortran processor is supposed to handle the
contiguity inside "sub" for arg1 and arg2 in the case that the caller is a
C function that passes non-contiguous CFI descriptor actual arguments.

The closest I found is:

"In an invocation of an interoperable procedure whose Fortran interface has
an assumed-shape or assumed-rank
dummy argument with the CONTIGUOUS attribute, the associated effective
argument may be an array that is
not contiguous or the address of a C descriptor for such an array. If the
procedure is invoked from Fortran or the
procedure is a Fortran procedure, the Fortran processor will handle the
difference in contiguity. If the procedure
is invoked from C and the procedure is a C procedure, the C code within the
procedure shall be prepared to
handle the situation of receiving a discontiguous argument."



XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20141008/45813b3a/attachment.html 

More information about the J3 mailing list