J3/06-269 Date: 3 August 2006 To: J3 From: Bill Long and John Reid Subject: Issues 49,50,51,55 : co-indexed actual arguments Reference: J3/06-007 Issue 49 (page 300) Issue 49 proposes that an interface should not be required just because one of the arguments in the procedure reference is a co-indexed object. As is noted in Issue 50, the choice to limit co-array actual arguments to correspond only to dummies with the INTENT(IN) or VALUE attribute causes inconsistencies with other parts of the language. On balance, we have concluded that it is better to allow more general dummy arguments. Since the requirement of an interface was based on the INTENT(IN) restriction, that requirement can be removed. Issue 50 (page 313) The note observes that the statement call sub(x[i]) is effectively the same as localvar = x[i] call sub(localvar) x[i] = localvar which is the usual copy-in/out argument passing pattern. We agree, but note that the assignment x[i] = localvar has limitations if x has allocatable components. These limitations would also have to apply to the assignments implied by the use of x[i] as an actual argument. On balance, we agree that allowing the compiler to generate both copy-in and copy-out code for a co-indexed actual argument provides better consistency in the language and should be permitted. The requirement of INTENT(IN) or VALUE for the dummy argument was aimed at allowing only copy-in. We note that C616 (p. 117) prevents the actual argument having a pointer component. However, it might be allocatable or have an allocatable component; copy-out should not be permitted in this case since it might be reallocated with a different shape during execution of the subprogram (or, see 06-241 - issue 20, we need to require that the shape matches). We believe the rule at [197:12-14] is sufficient to ensure memory consistency among images even for the copy-out case. Subclause 12.5.1.10 on the other hand ensures that on the image where the procedure reference is executed the co-indexed object is defined only via the dummy argument. Issue 51 (page 313) The conceptual model for co-arrays is that of a distributed memory system. Within that framework, the discussion of copy-in/out of co-indexed actual arguments is relevant and useful as an explanation of the normative text. If both copy-in and copy-out are allowed, the note needs to be reworded. We agree with the observation that the phrase "and the corresponding dummy argument is not a co-array" is extraneous and should not be part of the If condition at the beginning of the Note. Issue 55 (page 316) We agree with the editor's suggested constraint, and believe that the VOLATILE attribute should be included as well, similar to constraints C1236 and C1237, which also relate to the side-effects of copy-in/out. Edits to J3/06-007 [299:30] Remove subitem (1) (b). [312:23-24] Replace "and shall not have the INTENT(IN) or the VALUE attribute." with ". If the actual argument is allocatable or has an allocatable ultimate component, the dummy argument shall have the INTENT(IN) or the VALUE attribute." [313:1-] Replace the text of Note 12.22 with: "If the actual argument is a co-indexed object, it is likely that implementations for distributed memory systems will make a copy on the executing image of the actual argument, including copies of any allocated allocatable subcomponents, and the dummy argument is associated with that copy. If necessary, on return from the procedure, the value of the copy is copied back to the actual argument." [316:1+] Add a new constraint: "C1235a (R1223) An actual argument that is a co-indexed object shall not be associated with a dummy argument that has either the ASYNCHRONOUS or VOLATILE attribute."