J3/13-211 To: J3 From: Van Snyder Subject: Reduce restrictions on VALUE Date: 2013 December 19 Title: Reduce restrictions on VALUE Submitted by: Van Snyder Status: For consideration Basic functionality: Allow a dummy argument with the VALUE attribute to have the POINTER, ALLOCTABLE, VOLATILE, or OPTIONAL attribute, the latter only if it is not a dummy argument of a BIND(C) subprogram, is not an assumed-shape or assumed-size array, and has no assumed length parameters. Rationale: Reduces the number of statements and temporary variables, and thereby long-term cost. Estimated impact: Minor Markham M6 conformance: Remove simple deficiencies, discrepancies, and pointless restrictions. Detailed specification: There is no problem for a dummy argument with the VALUE attribute to have the POINTER attribute: It gets its initial pointer association status from the corresponding actual argument, if the actual argument is a pointer, or becomes pointer associated with the actual argument if the actual argument is not a pointer. There is no problem for a dummy argument with the VALUE attribute to be allocatable: If the actual argument is not allocatable the dummy argument is initially allocated and gets its shape and value from the corresponding actual argument. If the actual argument is allocatable, the dummy argument gets its initial allocation status, and, if allocated, its value, bounds, and deferred length parameter values, from the corresponding actual argument. There is no problem for a dummy argument with the VALUE attribute to be VOLATILE. Its volatility commences after it gets its value. There is no problem for a dummy argument with the VALUE attribute to be optional (except for BIND(C) procedures), and yet to exist even if the corresponding actual argument is absent, unless it has assumed shape, assumed size, or an assumed length parameter. If it is absent and neither allocatable nor a pointer its initial value -- except for default initialized subcomponents -- is undefined (but that doesn't prevent the procedure from defining it). If it is absent and allocatable it is initially not allocated (but that doesn't prevent the procedure from allocating it). If it is absent and a pointer its initial pointer association status is undefined (but that doesn't prevent the procedure from defining it). Draft edits: To estimate scope of project Replace C588 with C588 An entity with the VALUE attribute shall not have the INTENT(INOUT) or INTENT(OUT) attribute. If it has the OPTIONAL attribute it shall not be an assumed-shape or assumed-size array, or have an assumed length parameter. { Prohibition against simultaneous OPTIONAL and BIND(C) is covered by C1255a in TS 29113 (N1917). } Replace 12.5.2.3p4: "A nonpointer nonallocatable dummy argument with the VALUE attribute becomes associated with a definable anonymous data object. If the argument is present its initial value is the value of the actual argument. Otherwise it is initially undefined, except for default initialized subcomponents." In 12.5.2.3p5 insert "without the VALUE attribute" after "dummy argument". Insert paragraphs after 12.5.2.3p5: "A present pointer dummy argument with the VALUE attribute has the same pointer association status as the corresponding actual argument. The initial association status of an absent pointer dummy argument that has the VALUE attribute is undefined. "A present allocatable dummy argument with the VALUE attribute has the same allocation status as the corresponding actual argument. If the actual argument is allocated the initial bounds, value, and values of deferred length parameters of the dummy argument are the same as the actual argument. The initial allocation status of an absent allocatable dummy argument that has the VALUE attribute is deallocated."