(j3.2006) Coarray enquiry intrinsics

Malcolm Cohen malcolm
Tue May 30 21:19:42 EDT 2017

x%c[1,1,1] is not permitted.  The image-selector has to be attached to the
part-name that is itself a coarray, see F2015 constraint C914 [133:9].
That's what I meant by saying x%c is "not coindexable".


So the question of the cobounds of x%c literally can never arise, *except*
for LCOBOUND(x%c) and UCOBOUND(x%c).  There is literally no use whatsoever
for LCOBOUND(x%c) instead of LCOBOUND(x) --- you can add an image-selector
to follow x, you cannot add one to follow x%c.




..............Malcolm Cohen, NAG Oxford/Tokyo.


From: j3-bounces at mailman.j3-fortran.org
[mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Steidel, Jon L
Sent: Wednesday, May 31, 2017 5:37 AM
To: fortran standards email list for J3 <j3 at mailman.j3-fortran.org>
Subject: Re: (j3.2006) Coarray enquiry intrinsics


Hi Malcolm,


Given that in the case of an array, lbound (x) is [10, 30, 50] but lbound
(x%c) is {1, 1, 1], what is the implication on image selectors for the
coarray counterpart.


If we declare the following:



  REAL c


TYPE(t) x[10:20, 30:40, 50:*]


is x[10, 30, 50]%c  the same as  x%c[1, 1, 1]?


It would seem we'd want the same cobounds for a coarray which is a subobject
of a coarray to be the same as the cobounds for the coarray which it is a
subobject of.  Whether we allow a subobject of a coarray that is a coarray
as the argument to LCOBOUND or not, we need to answer what the cobounds are
for said subobject so that we know how to interpret image selectors for
subobjects of coarrays.  



From: j3-bounces at mailman.j3-fortran.org
<mailto:j3-bounces at mailman.j3-fortran.org>
[mailto:j3-bounces at mailman.j3-fortran.org] On Behalf Of Malcolm Cohen
Sent: Monday, May 29, 2017 3:22 AM
To: 'fortran standards email list for J3' <j3 at mailman.j3-fortran.org
<mailto:j3 at mailman.j3-fortran.org> >
Subject: (j3.2006) Coarray enquiry intrinsics


Hi folks,




Program junk

  Type t

    Real c

  End Type

  Type(t) x[10:20,30:40,50:*]

  Do i=1,3

    Print *,Lcobound(x%c,i)

  End Do

  Print *,Lcobound(x)

  Print *,Lcobound(x%c)

End Program


Since a subobject of a coarray is a coarray (unless vector subscripts are
involved), this would appear to be a valid program.  It does seem pretty
daft though.  Did we really intend to allow things like Lcobound(x%c) when X
is a coarray (and C is not a pointer, but could be either nonpointer
nonallocatable or an allocated allocatable)?


So far I am 1=Yes, 1=No by asking other compilers...


This seems especially interesting as in the array case,

   Type(t) y(10:20,30:40,50:99)

   Print *,Lbound(y)

we get the answers "1 1 1".  The "1=Yes" compiler produces the answer (for
LCOBOUND) "10 30 50".  But since it's not coindexable anyway, and we have no
way of "copying" the cobounds to something that is coindexable, the correct
answer for the lower cobounds of X%C is an interesting philosophical
question with no ramifications other than the return value of LCOBOUND...




..............Malcolm Cohen, NAG Oxford/Tokyo.


This e-mail has been scanned for all viruses by Star.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20170531/dfeab78c/attachment-0001.html 

More information about the J3 mailing list