To: J3 11-159r1
From: Bill Long / Reinhold Bader
Subject: Assumed-size descriptors
Date: 2011 June 27
Reference: WG5/N1854
The text of para 4 in 5.2.3 CFI_cdesc_t of N1854 ([10:30-32]) reads:
"If any actual argument associated with the dummy argument is an
assumed-size array, the array shall be simply contiguous, the
attribute member shall be CFI_attribute_unknown_size, and the
extent member of the last dimension of the dim member shall have
the value -2."
This paragraph seems out of place and muddled in the context of the
previous two paragraphs. And it has errors. The phrase "the attribute
member..." does not have a reference to what it is a member of. A
descriptor, one assumes. The "last dimension" of the dim member is
also the first dimension, as it has only one dimension. One might
assume the "last element". What array is it that is supposed to be
"simply contiguous"?
The paragraph is trying to say three things.
1) A C descriptor describing an assumed-size object shall describe an
object that is simply contiguous.
2) A C descriptor describing an assumed-size object shall have an
attribute member value of CFI_attribute_unknown_size.
3) In a C descriptor describing an assumed-size array, the extent
member of the last element of the dim member shall have the value -2.
A C descriptor can come into existence either by being created in a
Fortran caller, or by being established within a C function by use
CFI_establisd, CFI_section, or CFI_select_part. None of these
functions allows for establishment of a descriptor for an assumed-size
object. Thus, the only way for such a descriptor to exist is if it was
created by a Fortran caller. Within Fortran, an assumed-size object is
already simply contiguous. So, item (1) is unnecessary.
Similarly, item (2) will automatically be satisfied assuming the
Fortran processor is working correctly. The TR text at [11:14-15]
already specifies what "correctly" requires in this context.
So the whole content of the paragraph reduces down to (3). This is
still a requirement on the Fortran processor, not on the
programmer. But a requirement that is not otherwise stated, and
programmers need to know what to expect in the incoming descriptor.
To make more clear that assumed size actual arguments always
are contiguous, a Note is added at the end of the description
of CFI_is_contiguous.
Edit:
[10:30-32] Replace 5.2.3 CFI_cdesc_t para 4 with:
"In a descriptor of an assumed-size array, the extent member
of the last element of the dim member has the value -2."
[17:6+] Add the following note:
"Note 5.6+: A C descriptor whose attribute member has the value
CFI_attribute_unknown_size or CFI_attribute_allocatable
always describes a contiguous object."