Richard E Maine wrote:
> So let's look at that question instead of the question of whether
> ARRAY is a section, which doesn't seem to have much to do with the
> definition of LBOUND.
The "definition" of LBOUND is not really of relevance because it is
circular, in that it uses the plain English "lower-bound"
"If ARRAY is a whole array or array structure component and either ARRAY
is an assumed-size array of rank DIM or dimension DIM of ARRAY has
nonzero extent, LBOUND (ARRAY, DIM) has a value equal to the LOWER
BOUND [emphasis mine] for subscript DIM of ARRAY. Otherwise the result
value is 1."
We define what the "lower bound" is for explicit arrays, assumed-shape
arrays, pointers, allocatables, etc., but not for array sections. It
should say somewhere that it is 1 for array sections, but all I can
find in the standard is what the shape and rank are, not the bounds???
> Looks to me like, although typ%in is a section (per Aleksander's
> derivation), it is also a structure component. Odd, I thought those
> were mutually exclusive, but it sure doesn't look like it to me.
It seems so from the definition:
structure-component is data-ref
There shall be more than one part-ref and the rightmost part-ref shall
be of the form part-name.
I believe that the "array structure component" in the definition of
LBOUND refers to the case I pointed out:
scalar_of_type_t%array_component_of_type_t
It is not meant to apply to the case
array_of_type_t%scalar_component_of_type_t
which I agree with Richard it seems to.
In any case, we probably just messed up the definition of
structure-component (mostly it appears as scalar-structure-component in
the standard, so maybe arrays were not thought of well-enough).
Richard, can you please check F95 for this?
I am confident the answer to Bert's question is: The bounds in both
cases are [1,5]. Otherwise, every descent compiler (including NAG,
which is almost always right) would be wrong. g95 does not cut it in
the complete category yet. I know this is not a valid argument, but
there it goes.
Aleks
|