J3/06-108r1 Date: 2005/02/14 To: J3 From: Malcolm Cohen Subject: Contiguous integration - further edits 1. Introduction There is a technical flaw in the edits for the CONTIGUOUS with respect to TARGET dummy arguments and the dread interp 125. TARGET dummy arguments are divided into two classes; class one makes pointers associated with the dummy become (and remain on RETURN) associated with the actual argument, whereas in class two whether the pointers associated with the dummy are associated with the actual argument is processor-dependent. The flaw in the current edits is that assumed-shape dummy TARGETs with the CONTIGUOUS attribute are removed from class one but not inserted into class two. 2. Further considerations The desire has been expressed to be able to guarantee that, in certain situations, argument copying does not take place. (I.e. that pointers associated with the target dummy are associated with a target actual.) This feature is already present in the standard in a number of ways. For guaranteed-to-be-contiguous dummies, the feature is present as contiguous dummy pointers, e.g. REAL,CONTIGUOUS,POINTER :: dummy(:) However, this is slightly inconvenient to use, since the caller of the routine needs to create a pointer to pass as the actual argument (and associate the pointer with the target). We don't require that for dummy variables - one does not need to create a variable to pass an expression value as an actual argument. 2.1 Specification and Syntax That an actual argument with the TARGET attribute be acceptable for a dummy argument that has both the INTENT(IN) and POINTER attributes. If the dummy pointer has the CONTIGUOUS attribute the actual target shall also have the CONTIGUOUS attribute. {Note: This is to avoid getting an "undefined pointer" if the actual argument is not contiguous.} 2.2 Edits - first draft [269:14-15] Replace "If the dummy argument is a pointer, the actual argument shall be a pointer and" with "If the dummy argument and the actual argument are pointers," [269:14-] New paragraph "If the dummy argument is a pointer that does not have the INTENT(IN) attribute, the actual argument shall be a pointer. Otherwise, the actual argument shall be a pointer or a valid target for the dummy pointer in an assignment statement. If the actual argument is not a pointer, the dummy pointer becomes pointer-associated with the actual argument." {This would be simpler to describe if we allowed automatic pointer association to apply to non-intent(in) arguments, but that would be less safe.} [414:18+] Add new item (events that cause pointers to become associated): "(3) The pointer is a dummy argument and the actual argument is not a pointer." 2.3 Consequences/discussion This would be even more useful if (as requested by the author of 06-108), one could pass "known to be contiguous at compile time" arrays (in particular, explicit-shape arrays) here. We might wish to reconsider the earlier decision not to give such arrays the CONTIGUOUS attribute implicitly. 3. Repairing the original flaw - edit [270:13] Before "or is an assumed-size" insert ", is an assumed-shape array with the CONTIGUOUS attribute, " 4. Note for later The CONTIGUOUS edit for [78:2-] is really dodgy; it defines the set of things which are "contiguous" and also the set of things which are "not contiguous". So what are things that are not "contiguous" and not "not contiguous"? If the "not contiguous" definition is meant only to be an example, it should be turned in to an informative note. ===END===