(j3.2006) More questions on C descriptors

Daniel C Chen cdchen
Thu Nov 13 09:38:44 EST 2014


There is the following statement that pretty much describes how the lower
bound is supposed to be set.

"For a C descriptor of an array pointer or allocatable array, the value of
the lower_bound member of each element of the dim member of the descriptor
is determined by argument association, allocation, or pointer association.
For a C descriptor of a nonallocatable nonpointer object, the value of the
lower_bound member of each element of the dim member of the descriptor is
zero."

Thanks,

Daniel

XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
http://www.ibm.com/software/awdtools/fortran/xlfortran



From:	"Lionel, Steve" <steve.lionel at intel.com>
To:	fortran standards email list for J3 <j3 at mailman.j3-fortran.org>
Date:	11/11/2014 17:22
Subject:	(j3.2006) More questions on C descriptors
Sent by:	j3-bounces at mailman.j3-fortran.org



The text in the interop TS (and 14-007r2) describing the lower_bound
component of CFI_dim_t says: ?The value is equal to the value of the lower
bound for the dimension being described.? Since C doesn?t have the concept
of lower bounds, I assume this is the Fortran lower bound, but the examples
strongly suggest that the lower bound in the descriptor is 1 less than the
Fortran LB.  If I have a Fortran pointer array allocated as A(1:10) that
gets passed as a C descriptor, is the lower_bound in the descriptor 1 or 0?
What if it?s not a pointer (which in Fortran would always use a lower bound
of 1)? When CFI_establish does its thing, what does it set lower_bound to,
since none of the arguments to CFI_establish are lower bounds and therefore
the property isn?t given by or derived from the other arguments?

In the first example for CFI_section, the text says: ?If source is already
the address of a C descriptor for the rank-one Fortran array A, the lower
bounds of A are equal to 1, and the lower bounds in the C descriptor are
equal to 0, the following code fragment establishes a new C descriptor
section and updates it to describe the array section A(3::5)? , I am
wondering how the lower bounds in the C descriptor would be 0 if the
Fortran lower bounds are 1.  The example for CFI_address uses bounds [4,9]
corresponding to Fortran bounds (5,10), suggesting that the C descriptor
bounds are 0-based, but clearly I am missing some important point of how
lower bounds work in C descriptors.

Lastly, I note that the second example for CFI_section has references to
source->dim[0].lower, but the component is lower_bound, obviously a typo.
I?ll add this to my edits paper for February along with possible
clarification of the above questions.  Thanks.

Steve Lionel
Intel Developer Support
Merrimack, NH
 [attachment "smime.p7s" deleted by Daniel C Chen/Toronto/IBM]
_______________________________________________
J3 mailing list
J3 at mailman.j3-fortran.org
http://mailman.j3-fortran.org/mailman/listinfo/j3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20141113/846d9ba6/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20141113/846d9ba6/attachment.gif 



More information about the J3 mailing list