Visible to Intel only — GUID: GUID-9551E1DE-6E67-4D37-82AA-A9B166F65FFC
Visible to Intel only — GUID: GUID-9551E1DE-6E67-4D37-82AA-A9B166F65FFC
Argument Association
Arguments are the values passed to and from functions and subroutines through calling program argument lists.
Execution of a procedure reference establishes argument association between an actual argument and its corresponding dummy argument. The name of a dummy argument can be different from the name of its associated actual argument (if any).
When the procedure completes execution, the argument association is terminated. A dummy argument of that procedure can be associated with an entirely different actual argument in a subsequent invocation of the procedure.
Association Between Actual Arguments and Dummy Data Objects
A scalar dummy argument of a nonelemental procedure can be associated only with a scalar actual argument.
If the actual argument is scalar, the corresponding dummy argument must be scalar unless the actual argument is one of the following:
Of type default character
Of type character with the C character kind
An element or substring of an element of an array that is not an assumed-shape or pointer array
If the procedure is nonelemental and is referenced by a generic name or as a defined operator or defined assignment, the ranks of the actual arguments and corresponding dummy arguments must agree.
If a scalar dummy argument is of type default character, the length of the dummy argument must be less than or equal to the length of the actual argument. The dummy argument becomes associated with the leftmost len characters of the actual argument. If an array dummy argument is of type default character and is not assumed shape, it becomes associated with the leftmost characters of the actual argument element sequence and it must not extend beyond the end of that sequence.
If a dummy argument is not allocatable and is not a pointer, it must be type compatible with the associated actual argument. If a dummy argument is allocatable or a pointer, the associated actual argument must be polymorphic only if the dummy argument is polymorphic, and the declared type of the actual argument must be the same as the declared type of the dummy argument.
If the dummy argument is a pointer, the actual argument must be a pointer and the nondeferred type parameters and ranks must agree. If a dummy argument is allocatable, the actual argument must be allocatable and the nondeferred type parameters and ranks must agree. The actual argument can have an allocation status of unallocated.
At the invocation of the procedure, the pointer association status of an actual argument associated with a pointer dummy argument becomes undefined if the dummy argument has INTENT(OUT).
The dynamic type of a polymorphic, allocatable, or pointer dummy argument can change as a result of execution of an allocate statement or pointer assignment in the subprogram. Because of this behavior, the corresponding actual argument needs to be polymorphic and have a declared type that is the same as the declared type of the dummy argument, or an extension of that type.
The values of assumed type parameters of a dummy argument are assumed from the corresponding type parameters of the associated actual argument.
Except in references to intrinsic inquiry functions, if the dummy argument is not a pointer and the corresponding actual argument is a pointer, the actual argument must be associated with a target and the dummy argument becomes the argument associated with that target.
Except in references to intrinsic inquiry functions, if the dummy argument is not allocatable and the actual argument is allocatable, the actual argument must be allocated.
If the dummy argument has the VALUE attribute, it becomes associated with a definable anonymous data object whose initial value is that of the actual argument. Subsequent changes to the value or definition status of the dummy argument do not affect the actual argument.
If the dummy argument does not have the TARGET or POINTER attribute, any pointers associated with the actual argument do not become associated with the corresponding dummy argument on invocation of the procedure.
If the dummy argument has the TARGET attribute, does not have the VALUE attribute, is either a scalar or an assumed-shape array, and the corresponding actual argument has the TARGET attribute but is not an array section with a vector subscript, then the following is true:
Any pointers associated with the actual argument become associated with the corresponding dummy argument on invocation of the procedure.
When execution of the procedure completes, any pointers that do not become undefined and are associated with the dummy argument remain associated with the actual argument.
Any pointers associated with the dummy argument become undefined when execution of the procedure completes in these cases:
If the dummy argument has the TARGET attribute and the corresponding actual argument does not have the TARGET attribute, or is an array section with a vector subscript.
If the dummy argument has the TARGET attribute and the VALUE attribute.
If a nonpointer dummy argument has INTENT (OUT) or INTENT (INOUT), the actual argument must be definable. If a dummy argument has INTENT (OUT), the corresponding actual argument becomes undefined at the time the association is established, except for components of an object of derived type for which default initialization has been specified. If the dummy argument is not polymorphic and the type of the actual argument is an extension of the type of the dummy argument, only the part of the actual argument that is of the same type as the dummy argument becomes undefined.
Association Between Actual Arguments and Dummy Procedure Entities
If a dummy argument is a procedure pointer, the associated actual argument must be a procedure pointer, a reference to a function that returns a procedure pointer, or a reference to the NULL intrinsic function.
If a dummy argument is a dummy procedure without the POINTER attribute, the associated actual argument must be the specific name of an external, module, dummy, or intrinsic procedure, an associated procedure pointer, or a reference to a function that returns an associated procedure pointer. If the specific name is also a generic name, only the specific procedure is associated with the dummy argument.
For generic declarations, a dummy argument is type, kind, and rank compatible with another dummy argument if following is true:
The first is type compatible with the second.
The kind type parameters of the first have the same values as the corresponding kind type parameters of the second.
Both have the same rank or either is assumed-rank.
If an external procedure name or a dummy procedure name is used as an actual argument, its interface must be explicit or it must be explicitly declared to have the EXTERNAL attribute.
If the interface of the dummy argument is explicit, the procedure characteristics must be the same for the associated actual argument and the corresponding dummy argument, except that a pure actual argument can be associated with a dummy argument that is not pure, and an elemental intrinsic actual procedure can be associated with a dummy procedure that is prohibited from being elemental.
If the interface of the dummy argument is implicit and either the name of the dummy argument is explicitly typed or it is referenced as a function, the dummy argument must not be referenced as a subroutine and the actual argument must be a function, function procedure pointer, or dummy procedure.
If the interface of the dummy argument is implicit and a reference to it appears as a subroutine reference, the actual argument must be a subroutine, subroutine procedure pointer, or dummy procedure.
An assumed-rank dummy argument can correspond to an actual argument of any rank. If the actual argument has rank zero (is a scalar), the dummy argument has rank zero; the shape is a zero-sized array and the LBOUND and UBOUND intrinsic functions, with no DIM argument, return zero-sized arrays. If the actual argument has rank greater than zero, the rank and extents of the dummy argument are assumed from the actual argument, including the lack of a final extent in the case of an assumed-size array. If the actual argument is an array and the dummy argument is allocatable or a pointer, the bounds of the dummy argument are assumed from the actual argument.
An assumed-type dummy argument must not correspond to an actual argument that is of a derived type that has type parameters, type-bound procedures, or final subroutines.
Association For C Interoperability
When a Fortran procedure that has an INTENT(OUT) allocatable dummy argument is invoked by a C function, and the actual argument in the C function is the address of a C descriptor that describes an allocated allocatable variable, the variable is deallocated upon entry to the Fortran procedure.
When a C function is invoked from a Fortran procedure by means of an interface with an INTENT(OUT) allocatable dummy argument, and the actual argument in the reference to the C function is an allocated allocatable variable, the variable is deallocated on invocation (before execution of the C function begins).