(j3.2006) Question about pointer components of coindexed objects

John Reid John.Reid
Mon Jul 24 04:58:39 EDT 2017


Malcolm,

This looks to me like an oversight in F2008 that we have carried over to 
F2015. We had a design objective that pointer association be local. For 
allocate and deallocate, we have

C949 (R933) An allocate-object shall not be a coindexed object.

For pointer assignment, we have

C1024 (R1034) A data-pointer-object shall not be a coindexed object.
C1026 (R1037) A data-target shall not be a coindexed object.

We seem to have forgotten to have such a constraint for nullify. Note that

     x[1]%p => null()

is not permitted.

John.



Malcolm Cohen wrote:
> Hi folks,
>
>
>
> Consider:
>
>
>
> Program n9a
>
>   Type t
>
>     Integer,Pointer :: p
>
>   End Type
>
>   Type(t) x[*]
>
>   Nullify(x[1]%p)
>
>   Print *,'ok if F?',Associated(x[1]%p)
>
> End Program
>
>
>
> There are two questions:
>
>
>
> (1)  Is the NULLIFY conforming?  It certainly looks conforming to me.
> However another compiler claims that it is not permitted.
>
>
>
> (2) If the ASSOCIATED conforming?  Since we?re allowed to follow
> pointers on other images, e.g. ?x[1]%p = 3?, I don?t see why it should
> be a problem.  However, one compiler thinks it falls foul of
>
>                 C1542 The actual argument corresponding to a dummy
> pointer shall not be a coindexed object.
>
> It is not at all obvious that C1542 should apply to intrinsic
> procedures?  A second compiler claimed that x[1]%p was not a pointer,
> throwing further confusion onto the fire.  Anyway, I think that either
> ASSOCIATED should say that you can?t use it on coindexed objects, or
> C1542 should be followed by a Note saying it does not apply to the
> ASSOCIATED intrinsic, to clarify the situation.
>
>
>
> Any comments about these cases would be welcome (especially from Bill!).
>
>
>
> Cheers,
>
> --
>
> ..............Malcolm Cohen, NAG Oxford/Tokyo.
>
>
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>



More information about the J3 mailing list