[J3] Question not just for HPC

Bill Long longb at cray.com
Wed Oct 16 23:16:06 EDT 2019

> On Oct 16, 2019, at 5:25 PM, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org> wrote:
> Hi Bill,
> > Type locktype has a component of type lock_type (obviously). A subobject is just a part of an object that can be referenced (3.141), so the component is clearly a subobject of x. So, could you explain how the word “potential” makes the statement above true? 
> Two things here:
> 	• The component is not a subobject of X except in pointer association contexts. The word “subobject” cannot be applied to types, only to objects, we have other terms that can be applied to types.
> 	• “potential subobject component” is a defined term that applies to types as well as objects. It explicitly excludes pointer components.
> > Having something pointer associated with a coarray does not make the pointer itself a coarray. Only being declared to be a coarray (having a codimension) makes something a coarray. 
> Well yeah, that’s what I said – there’s no rule saying X has to be a coarray, and I noted that X%Q is not a coarray.
> There is no requirement in LOCK that the lock variable has to be a coarray.

Program co428
  Use Iso_Fortran_Env
  Type(lock_type),Target :: p[*]
  Type lockpointer
    Type(lock_type),Pointer :: q
  End Type
  Type(lockpointer) x
  x%q => p
  Print *,'Is this really ok?'
End Program

C1608  A named variable with declared type LOCK_TYPE shall be a coarray. A named variable with a noncoarray potential subobject component of type LOCK_TYPE shall be a coarray.

R1179 lock-stmt is LOCK ( lock-variable [ , lock-stat-list ] )

R1182 lock-variable is scalar-variable

C1182 (R1182) A lock-variable shall be of type LOCK_TYPE from the intrinsic module ISO_FORTRAN_ENV (

C852  An entity with the POINTER attribute shall not have the ALLOCATABLE, INTRINSIC, or TARGET attribute, and shall not be a coarray.

     -> Because x%q is a pointer it cannot be a coarray. 

So, the whole argument here seems to hinge on the fact that x%q is not a “named variable”. Since if it were, it would have to be a coarray.  Also, the LOCK statement in the example is only locking a local lock.  Which is very peculiar, but apparently allowed. 


> Cheers,
> -- 
> ..............Malcolm Cohen, NAG Oxford/Tokyo.

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray, a Hewlett Packard Enterprise company/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425

More information about the J3 mailing list