(j3.2006) lower bounds of results of array valued functions

Jim Xia jimxia
Mon Jul 27 09:44:18 EDT 2009


Interesting nobody has reported what we do.  Here it goes

 2
 1
 1
 1
 1
 5


It may seem that all implementers got the last value wrong.  I was 
wondering if this was what the standard intended to do to vendors :-)

Cheers,

Jim Xia

XL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM

http://www.ibm.com/software/awdtools/fortran/xlfortran



From:
Bill Long <longb at cray.com>
To:
fortran standards email list for J3 <j3 at j3-fortran.org>
Date:
07/26/2009 10:03 PM
Subject:
Re: (j3.2006) lower bounds of results of array valued functions





Malcolm Cohen wrote:


> 
> (And I don't think we're going to be changing the definition of whole 
> array any time soon.)

I would not expect a change to "whole array". That would have side 
effects elsewhere.  However, the possibility of allocable function 
results did not exist when the lbound() rules were made 20 years ago. 
The issue here is what the rules for lbound() should have been in light 
of that change in f03. Perhaps "whole array or function result that is 
allocatable or pointer" would be an alternative.  That version is easier 
to implement, and more consistent with the way we treat arguments.


> 
>> I would expect the descriptor for the result of H() to be passed to 
sub,
>> and 5 printed.
>> 
> That's not what we decided, and not what the standard says.

So far I have not found a compiler that agrees with this interpretation. 
  Even the one that printed 1 for the expression cases printed 5 in sub.

> 
> "allocatable" is an attribute that is only possessed by variables.  The 
> return value of an allocatable array function is just an array value -


This sounds entirely logical and reasonable. And yet we specifically 
discuss the "allocatable result" and specify exactly when it is 
deallocated.  You can't deallocate something that is not allocatable, so 
the idea that the result is not allocatable seems to contradict 
[130:27-30].  I don't think Bob is off the mark in suggesting there are 
ambiguities here.

Cheers,
Bill





> which must be entirely defined, just like any other nonpointer 
> function.  The only material difference between an allocatable array 
> function and an ordinary array function is that you don't have to decide 

> on the size of the result on entry to the function, and you can change 
> your mind during execution of the function.  That is just about it.
> 
> Cheers,

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120


_______________________________________________
J3 mailing list
J3 at j3-fortran.org
http://j3-fortran.org/mailman/listinfo/j3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20090727/d8ff2b3f/attachment.html 



More information about the J3 mailing list