[J3] Lower bound of an allocatable array function result

Robert Corbett rpcorbett at att.net
Sat Jun 15 01:48:08 EDT 2019


We changed the way DIM arguments in intrinsic procedures are handled in Fortran 2018.  The change in LBOUND is probably related to the changes made to DIM arguments.

Robert Corbett

> On Jun 14, 2019, at 8:39 PM, Vipul Parekh via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> 
> 
>> On Fri, Jun 14, 2019 at 7:34 PM Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org> wrote:
>> The standard clearly says that the result of LBOUND of any array function reference is 1.
>>  
>> Just read the words guys!
>>  
>> The only case where LBOUND can return anything other than one is when ARRAY is a “whole array”. Which is conveniently hyperlinked to the definition of the term “whole array” as “array component or array name without further qualification”. QED.
> 
> Ok so my takeaway here is to start searching in the standard for what one is looking for e.g., search for LBOUND when one wants to know what LBOUND will return under a particular situation, DUH to self! :-)
> 
> Except that in this circumstance, I doubt I could have figured out a useful response for Jon.
> 
> Note 18-007r1 states under p5 Case(i) for LBOUND, "If DIM is present, ARRAY is a whole array, and either ARRAY is an assumed-size array of rank DIM or dimension DIM of ARRAY has nonzero extent, the result has a value equal to the lower bound for subscript DIM of ARRAY. Otherwise, if DIM is present, the result value is 1."  This last sentence can raise more questions than it answers, I think.
> 
> Now 10-007r1 had instead, "If ARRAY is a whole array 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 for subscript DIM of ARRAY. Otherwise the result value is 1."
> 
> A quick search at the J3 site suggests papers such as J3/14-106 might have led to edits to the first sentence.  But I couldn't locate any paper behind the change to the second sentence in 18-007r1.  Can anyone point me to it?
> 
> The blurb in 10-007r1 appears clearer to me.
> 
> Thanks,
> Vipul Parekh
> 
> 
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190614/c5aa13b2/attachment.html>


More information about the J3 mailing list