[J3] Changing address of an allocatable on assignment when shapes match

Robert Corbett rpcorbett at att.net
Tue Aug 27 04:24:55 EDT 2019


The function LOC is not particularly useful unless a different pointer model is adopted.  Getting the address of an entity as an integer is sometimes handy for debugging, but to be useful in a meaningful way, it is necessary to provide ways to use those addresses.  The function LOC is an essential part of the pointer model referred to as {Cray, DEC, Sun, LWG} pointers.  That pointer model is similar to PL/I's based variables.

I would have supported a different pointer model in Fortran 90.  I am less inclined to add another pointer model to Fortran 202X.

Fortran has adopted several models of parallelism, and there are always proposals to add more, but I am not certain the language is better for it.

Bob Corbett

> On Aug 27, 2019, at 12:15 AM, Anton Shterenlikht via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> 
> 
>> On 23 Aug 2019, at 23:41, Bill Long via J3 <j3 at mailman.j3-fortran.org> wrote:
>> None of the 4 implementations ...
> 
> I haven't encountered LOC() before.
> Seems it's a popular extension to the standard,
> implemented in at least 4 processors - maybe more?
> 
> 1. For extensions like LOC - how does one know that LOC
> is doing the same thing in all those 4 processors?
> 
> 2. If LOC is so popular (and useful?) why not standardise it in F202X?
> 
> Anton
> 
> 
>> 
>> 
>> 
>>> 
>>> Steve
>>> 
>>> program test
>>> implicit none
>>> real, dimension(:), allocatable :: S
>>> integer :: i, idx(7) = [1,3,5,7,2,4,6]
>>> 
>>> allocate(S(size(idx)))
>>> do i=1,size(S)
>>> S(i) = i*i
>>> end do
>>> 
>>> write(6,*) S
>>> write(6,*) loc(S)
>>> 
>>> S = S(idx)
>>> 
>>> write(6,*) S
>>> write(6,*) loc(S)
>>> 
>>> S(:) = S(idx)
>>> 
>>> write(6,*) S
>>> write(6,*) loc(S)
>>> 
>>> deallocate(S)
>>> 
>>> end program
>>> 
>>> $ sunf90 -V
>>> f90: Studio 12.6 Fortran 95 8.8 Linux_i386 2017/05/30
>>> 
>>> $ sunf90 test.f90 ; ./a.out
>>> 1.0 4.0 9.0 16.0 25.0 36.0 49.0
>>> 37518752
>>> 1.0 9.0 25.0 49.0 4.0 16.0 36.0
>>> 37519840
>>> 1.0 25.0 4.0 36.0 9.0 49.0 16.0
>>> 37519840
>>> 
>> 
>> Bill Long                                                                       longb at cray.com
>> Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
>> Bioinformatics Software Development                      fax:  651-605-9143
>> Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425
>> 
>> 
> 



More information about the J3 mailing list