(j3.2006) Coarray enquiry intrinsics

Malcolm Cohen malcolm
Mon May 29 03:21:59 EDT 2017

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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20170529/4f56ea3f/attachment.html 

More information about the J3 mailing list