J3/05-147r1 To: J3 From: Bill Long/HPC Subject: New Intents Date: 8-Feb-2005 At M167, this idea got a Hate .. Love score of 4 - 2 - 5 - 1. However, we think it's worth pursuing for the potential performance benefits. Either of these two new intents could be removed without affecting the other. Number: Title: New Intents Submitted By: J3 Status: For Consideration References: J3/04-135 Basic Functionality: ------------------- Add two new intents 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. INTENT(NODEFREF) specifies that the argument will not be used within the procedure. It is present for generic disambiguation only. Compilers may be able to better follow the data flow of a program when the procedure and its caller are not both visible. Rationale: ---------- Many older Fortran programs have dummy arguments which are used for scratch work space only. Any use of existing argument intents gives wrong information to the compiler. Also, in the process of converting scratch work arrays in common blocks to allocatable dummy arguments, there is no proper intent for 'scratch' variables. An optimizing compiler could scalarize a dummy argument array known to be scratch. Also, final values of the dummy argument do not need to be stored. Sometimes, an argument is used solely to disambiguate a generic procedure reference. Common examples include functions where there are otherwise no arguments with the type of the result, such as IEEE_VALUE. If the compiler knows that the argument will not be referenced or defined in the procedure, the call overhead could be reduced. Estimated Impact: The impact was rated as 5 on the John Reid scale at 167. ----------------- Detailed Specification: ----------------------- Two new INTENT attributes are proposed, INTENT(SCRATCH) and INTENT(NODEFREF). 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. A dummy argument with the INTENT(NODEFREF) attribute is undefined upon entry to the procedure and shall not appear in a definition context within the procedure. It shall not have the OPTIONAL attribute. History: J3/04-135 at M167