To: J3 Subject: Guaranteed no copy in/out and TARGET From: Aleksandar Donev Date: 2008 April 28 The current draft has not made any changes to the way copy in/out interacts with the TARGET attribute on the dummy and/or actual arguments, even though the important concepts of a contiguous and simply contiguous object were introduced. I believe this is an integration omission and we need to update some of the rules in clause 12.5.2.4. Guaranteed copy-less argument passing is useful when pointers are involved. This is especially true with C Interop, where many routines may take and keep a pointer to the actual. The only way to propagate pointer association across procedure calls in the current standard is to have the TARGET attribute on both the dummy and the actual, and to make the dummy an assumed-shape array or a pointer. This last restriction makes this feature hard to use when updating old codes or existing widely-used interfaces (example, MPI), or with C Interop. It was there in previous revisions of Fortran in order to avoid having the user rely on, and compilers to implement, run-time checks for contiguity of the actual when the dummy expects a contiguous array (assumed-size, explicit shape, and in F2008, assumed-shape with the CONTIGUOUS attribute). The restriction is no longer needed in F2008, since users need to understand and compilers have to implement at least the basic compile-time test for simply contiguous objects. Therefore, in F2008, we should guarantee no copy in/out when the dummy is a TARGET and is explicit shape, assumed size, or assumed shape with the CONTIGUOUS attribute, and the actual is a simply contiguous TARGET. This is in addition to the existing guarantee when the dummy is assumed-shape. This change is analogous to what we already did in C1238 for ASYNCHRONOUS dummies: The intention there was that when the actual is simply contiguous we know there won't be any copy in/out. We should provide this implicit guarantee explicitly to programmers. Edits are provided to make this integration change. Edits against 08-007r2: ------------- [290] 12.5.2.4 Ordinary dummy variables, para. 9 Replace the sentence before the bullet item list with: "If the dummy argument has the TARGET attribute, does not have the VALUE attribute, and: 1) The dummy argument is a scalar or an assumed-shape array that does not have the CONTIGUOUS attribute, and the effective argument has the TARGET attribute but is not a coindexed object or an array section with a vector subscript, or 1) The dummy argument is an explicit-shape array, an assumed-shape array with the CONTIGUOUS attribute, or an assumed-size array, and the effective argument is simply contiguous and has the TARGET attribute but is not a coindexed object then:" ------- [290] 12.5.2.4 Ordinary dummy variables, para. 10 Replace the sentence before the bullet item list with: "If the dummy argument has the TARGET attribute and is an explicit-shape array, an assumed-shape array with the CONTIGUOUS attribute, or an assumed-size array, and the effective argument is not simply contiguous, has the TARGET attribute, and is not an array section with a vector subscript then"