Argument association

Actual arguments are associated with dummy arguments when a function or subroutine is referenced. In a procedure reference, the actual argument list identifies the correspondence between the actual arguments provided in the list and the dummy arguments of the subprogram.

Fortran 2003 begins The reduced dummy argument list is the full dummy argument list or, if there is a passed-object dummy argument, the dummy argument list with the passed object dummy argument omitted. When there is no argument keyword, an actual argument is associated with the dummy argument that occupies the corresponding position in the reduced dummy argument list. The first actual argument becomes associated with the first dummy argument in the reduced list, the second actual argument with the second dummy argument, continuing until reaching the end of the list. Each actual argument must be associated with a dummy argument. Fortran 2003 ends

When a keyword is present, the actual argument is associated with the dummy argument whose name is the same as the argument keyword. In the scoping unit that contains the procedure reference, the names of the dummy arguments must exist in an accessible explicit interface.

Argument association within a subprogram terminates upon execution of a RETURN or END statement in the subprogram. There is no retention of argument association between one reference of a subprogram and the next reference of the subprogram, unless you specify -qxlf77=persistent and the subprogram contains at least one entry procedure.

If associated with a null argument in a procedure reference, the corresponding dummy argument is undefined and undefinable.

IBM extension begins Except when %VAL or the VALUE attribute is used, the subprogram reserves no storage for the dummy argument. It uses the corresponding actual argument for calculations. Therefore, the value of the actual argument changes when the dummy argument changes. If the corresponding actual argument is an expression or an array section with vector subscripts, the calling procedure reserves storage for the actual argument, and the subprogram must not define, redefine, or undefine the dummy argument.

If the actual argument is specified with %VAL, or the corresponding dummy argument has the VALUE attribute, the subprogram does not have access to the storage area of the actual argument. IBM extension ends

Actual arguments must agree in type and type parameters with their corresponding dummy arguments (and in shape if the dummy arguments are pointers or assumed-shape), except for two cases: a subroutine name has no type and must be associated with a dummy procedure name that is a subroutine, and an alternate return specifier has no type and must be associated with an asterisk.

Argument association can be carried through more than one level of procedure reference.

If a subprogram reference causes a dummy argument in the referenced subprogram to become associated with another dummy argument in the referenced subprogram, neither dummy argument can become defined, redefined, or undefined during that subprogram. For example, if a subroutine definition is:
   SUBROUTINE XYZ (A,B)
and it is referenced by:
   CALL XYZ (C,C)

the dummy arguments A and B each become associated with the same actual argument C and, therefore, with each other. Neither A nor B can be defined, redefined, or undefined during the execution of subroutine XYZ or by any procedures referenced by XYZ.

If a dummy argument becomes associated with an entity in a common block or an entity accessible through use or host association, the value of the entity must only be altered through the use of the dummy argument name, while the entity is associated with the dummy argument. If any part of a data object is defined through a dummy argument, the data object can be referenced only through that dummy argument, either before or after the definition occurs. These restrictions also apply to pointer targets.

IBM extension begins If you have programs that do not conform to these restrictions, using the compiler option -qalias=nostd may be appropriate. See the -qalias option in the XL Fortran Compiler Reference for details. IBM extension ends

An allocated allocatable component of an actual argument that is associated with an INTENT(OUT) dummy argument is deallocated on procedure entry so that the corresponding component of the dummy argument has an allocation status of not allocated. This ensures that any pointers that point to the previous contents of the allocatable component of the variable become undefined.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us