(j3.2006) More questions on C descriptors

Lionel, Steve steve.lionel
Tue Nov 11 17:21:49 EST 2014


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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20141111/9b5a3de4/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6616 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20141111/9b5a3de4/attachment.bin 



More information about the J3 mailing list