J3/05-236r1 Date: 09 August 2005 To: J3 From: Rob James Subject: Specification, syntax, and edits for intent(scratch) attribute References: Feature j3-044, 05-147r2 ---------------------------------------------------------------------- Summary: -------- Add a new intent for dummy arguments: INTENT(SCRATCH) specifies that the dummy argument is undefined on entry and return. The argument may be used for scratch work space only. Compilers may be able to optimize this argument aggressively. This is feature J3-044. Specification and Syntax: ------------------------- A new INTENT(SCRATCH) attribute is proposed. The actual argument associated with a dummy argument with the INTENT(SCRATCH) attribute shall be definable. The dummy argument is undefined upon entry to the procedure and becomes undefined upon exit from the procedure. Edits: ------ Note: < and > are used to delimit italic font. << and >> are used to delimit bold font. All page and line numbers refer to j3/04-007. ..................................................................... In the Introduction section (page xiii), the list of new Fortran 2008 features should include Performance enhancements: INTENT(SCRATCH) attribute. ..................................................................... In section 1.6 Compatibility, there are no changes needed. ..................................................................... 72:35+. Add a new constraint: C515a (R501) If the INTENT(SCRATCH) attribute is specified, the POINTER attribute shall not be specified, and the shall be a data object. ..................................................................... 73:20. In constraint C527, replace "or INTENT(OUT)" with: INTENT(OUT), or INTENT(SCRATCH) ..................................................................... 81:5+. Add to the end of R517 for : or SCRATCH ..................................................................... 81:33+. Add a new paragraph and Note: The INTENT(SCRATCH) attribute for a dummy argument specifies that it is intended neither to receive data from nor to return data to the invoking scoping unit. Rather, such a dummy argument is intended for use as scratch space during execution of the procedure. Such a dummy argument shall be defined before a reference to the dummy argument is made within the procedure and any actual argument that becomes associated with such a dummy argument shall be definable. On exit from the procedure, the associated actual argument becomes undefined. Note 5.11a The INTENT(SCRATCH) attribute enables potential code optimizations for a dummy argument that is used only for local scratch space in a procedure. The final value of such a dummy argument does not need to be stored. Indeed, the processor may be able to represent the dummy argument in processor registers and never load from, or store to, the memory of the associated actual argument. [end Note] ..................................................................... 422:17+. In item (3) of the list in subsection 16.5.6, Events that cause variables to become undefined, at the end of subitem (c), remove the final "and"; at the end of subitem (d), replace the final "." with ", and"; and add a new subitem: (e) an actual argument associated with a dummy argument with the INTENT(SCRATCH) attribute becomes undefined. ..................................................................... 424:2. In item 11 of subsection 16.5.7 of Variable definition context, change the end of the second line from "INTENT(OUT) or INTENT(INOUT) attribute, or" to: INTENT(OUT), INTENT(INOUT), or INTENT(SCRATCH) attribute, or .....................................................................