(j3.2006) Can initial-data-target be coindexed?

Lionel, Steve steve.lionel
Thu Aug 13 15:24:47 EDT 2015


In pointer assignment, the standard is quite clear that data-target cannot
be coindexed:

 

C725 (R737) A data-target shall not be a coindexed object.

 

And there are a couple of notes related to this (citations from 12-007 - I
note that the numbering is a bit different in 10-007r1):

 

NOTE 7.45

A data pointer and its target are always on the same image. A coarray may be
of a derived type with pointer

or allocatable subcomponents. For example, if PTR is a pointer component,
Z[P]%PTR is a reference to the

target of component PTR of Z on image P. This target is on image P and its
association with Z[P]%PTR

must have been established by the execution of an ALLOCATE statement or a
pointer assignment on image

P.

 

NOTE 7.46

A pointer assignment statement is not permitted to involve a coindexed
pointer or target, see C723 and

C725. This prevents a pointer assignment statement from associating a
pointer with a target on another

image. If such an association would otherwise be implied, the association
status of the pointer becomes

undefined. For example, a derived-type intrinsic assignment where the
variable and expr are on different

images and the variable has an ultimate pointer component.

 

Ok so far. F2008 added the ability to specify an initial-data-target in
pointer initialization:

 

19 R505 initialization is = constant-expr

20 or => null-init

21 or => initial-data-target

22 R506 null-init is function-reference

23 C510 (R503) If => appears in initialization, the entity shall have the
POINTER attribute. If = appears in

24 initialization, the entity shall not have the POINTER attribute.

25 C511 (R503) If initial-data-target appears, object-name shall be
data-pointer-initialization compatible with it

26 (4.5.4.6).

 

Initial-data-target is defined in 4.5.4.6 and the only constraints for it
are:

 

1 C460 (R442) If initial-data-target appears, component-name shall be
data-pointer-initialization compatible

2 with it.

3 C461 (R443) The designator shall designate a nonallocatable variable that
has the TARGET and SAVE attrib-

4 utes and does not have a vector subscript. Every subscript, section
subscript, substring starting point,

5 and substring ending point in designator shall be a constant expression.

 

18 2 A pointer variable or component is data-pointer-initialization
compatible with a target if the pointer is type

19 compatible with the target, they have the same rank, all nondeferred type
parameters of the pointer have the

20 same values as the corresponding type parameters of the target, and the
target is contiguous if the pointer has

21 the CONTIGUOUS attribute.

 

So. what in the standard disallows the following?

 

program test

integer, save, target :: C[*]

integer, pointer :: P => C[3]

end

 

Shouldn't there be a constraint "An initial-data-target shall not be a
coindexed object"?

 

I looked through interpretations and saw no discussion of this. Interp
fodder?

 

Steve Lionel

Intel Developer Support

Merrimack, NH

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20150813/5cc2865b/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6616 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20150813/5cc2865b/attachment.bin 



More information about the J3 mailing list