J3/05-148r1 To: J3 From: Bill Long/HPC Subject: Same Shape Date: 8-feb-2004 This is the same assumed shape paper, for doneness. The idea got a Hate .. Love vote of 0 - 0 - 11 - 1 at M167. This revision is a generalization of the original proposal. Number: Title: same shape arrays Submitted By: J3 Status: For Consideration References: J3/04-136 Basic Functionality: -------------------- Provide syntax to specify that an array has the same shape and bounds as a specified array. Rationale: ---------- Compilers will be able to generate more efficient code when they can assume that several arrays all have the same shape and bounds. It is also a convenience to programmers, especially for the declaration of automatic arrays with the same shape and bounds as a dummy argument. Estimated Impact: the effort was estimated as 5 on the John Reid scale at 167. ----------------- Detailed Specification: ----------------------- A new declaration attribute, BOUNDS(), is provided to specify that the variable being declared has the same shape and bounds as the specified . If is an assumed-shape array, the variable is an assumed-shape array if it is a dummy argument; otherwise the variable is an explicit-shape array. If is a deferred-shape array, the variable is a deferred-shape array if it is a dummy argument or has the pointer or allocatable attributes; otherwise the variable is an explicit-shape array. If is an explicit-shape array, the variable is an explicit-shape array. If the variable and are both assumed-shape dummy arguments, the associated actual arguments shall have the same shape. If the variable and are both deferred-shape dummy arguments, the associated actual arguments shall have the same shape and bounds. The bounds of shall be previously specified in the same scoping unit, or shall be accessible by USE or host association. If the is a pointer, it shall be associated at entry to the scoping unit containing the declaration. If the is allocatable, it shall be allocated at entry to the scoping unit containing the declaration. The bounds of the variable being declared are not affected by subsequent changes to the bounds of . A corresponding BOUNDS() :: statement is also supplied. For example, real, dimension(:,:,:) :: a real, bounds(a) :: b ! instead of real,dimension(:,:,:) :: b History: J3/04-136