(j3.2006) Question about lbound of an assumed-rank entity
Wed Mar 1 19:15:53 EST 2017
You keep on quoting this stuff about the C descriptor. Which has nothing to
do with the question, which is what the Fortran lower bounds are. Which is
currently specified to be "bad".
You cannot work backwards from some implementation details to decide
semantic questions on the Fortran language! (It's frequently *useful* to
consider implementation details to make sure one has the right idea about
what is supposed to be going on, but those considerations are not useful in
answering questions about Fortran semantics per se.)
From: Bill Long
Sent: Thursday, March 2, 2017 4:03 AM
To: fortran standards email list for J3
Subject: Re: (j3.2006) Question about lbound of an assumed-rank entity
On Mar 1, 2017, at 3:08 AM, Cohen Malcolm <malcolm at nag-j.co.jp> wrote:
>> terms like ?assumed-bounds? or ?assumed-shape? when talking about
>> assumed-rank just confuse the issue.
> No they do not. The current text says
> "If the rank is nonzero, the lower and upper bounds of the dummy
> are those that would be given by the intrinsic functions LBOUND and UBOUND
> respectively if applied to the actual argument,"
> ... which in fewer words, means "the dummy assumes the bounds of the
> actual", i.e. it is the very definition of "assumed-bounds?.
Then there might be a contradiction. Whether the bounds are assumed from
the actual argument, or assigned internally is independent of whether the
dummy is assumed-rank. It does depend on whether it is allocatable/pointer
or not. 18.5.3p3:
"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
That?s what you get in the C descriptor, which is all the information you
have if the procedure is BIND(C). You have to assume the caller was C for
interpreting the descriptor, whether it was actually or not.
The question is what is the value of the lower bound as seen in the callee.
For a C callee, the value in the descriptor is the lower bound value. For a
Fortran callee, where it is possible to call LBOUND, the result should be
what you get from applying LBOUND to the dummy argument (almost of the
definition of LBOUND). That would be the actual argument?s lower bound(s)
if the dummy is allocatable or pointer, and 1 otherwise. LBOUND has to be
?taught? how to interpret a C descriptor.
> ...whereas the TS (in the non-edits section) said the dummy "assumes the
> extents"; since the extents form the shape, this is the very definition of
The extents are assumed whether the argument is allocatable, pointer, or
assumed-shape. The original question was, if I recall, about the lower
bounds. The extents and bounds are separate issues.
> assumed-shape. (plus there is the exception for assumed-size, but that's
> exception whether you talk about "assumed extents" or "assumed-shape".
> I make no apology for using obvious terminology in place of unwieldy
> No one has suggested changing what is passed in the lower_bound members.
> I am pleased that you do not disagree with what was actually suggested,
> which is to make the lower bounds in Fortran equal to 1.
> .............Malcolm Cohen, NAG Oxford/Tokyo.
> J3 mailing list
> J3 at mailman.j3-fortran.org
longb at cray.com
Fortran Technical Support & voice:
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
J3 mailing list
J3 at mailman.j3-fortran.org
This e-mail has been scanned for all viruses by Star.
.............Malcolm Cohen, NAG Oxford/Tokyo.
More information about the J3