[J3] Changing address of an allocatable on assignment when shapes match
Malcolm Cohen
malcolm at nag-j.co.jp
Tue Aug 27 03:53:10 EDT 2019
LOC is a pretty ancient hack. If it did anything reliably “useful”, everything would implicitly have the TARGET attribute, just like C.
You’re a month too late to suggest adding new features to F202x. You’ll have to wait for F202y.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Anton Shterenlikht via J3
Sent: Tuesday, August 27, 2019 4:16 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Anton Shterenlikht <ashterenli at cray.com>
Subject: Re: [J3] Changing address of an allocatable on assignment when shapes match
> On 23 Aug 2019, at 23:41, Bill Long via J3 <j3 at mailman.j3-fortran.org <mailto: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 <mailto: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
>
>
Disclaimer
The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice> for information on how we process personal data and for details of how to stop or limit communications from us.
This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190827/3bbc228e/attachment-0001.html>
More information about the J3
mailing list