If the dummy argument of any subprogram has the DYNAMIC attribute, then an explicit interface is required for the subprogram (see subsection 8.14). The rules on the interaction of the REALIGN and REDISTRIBUTE directives with a subprogram argument interface are:
The effect of any redistribution of the dummy after the procedure returns to the caller is dependent on the attribute of the actual argument. If the actual argument associated with the dummy has also been declared DYNAMIC, then any explicit remapping of the dummy is visible in the caller after the procedure returns. If a range directive (see Section 8.11) has been used to restrict the set of distribution formats allowed for the actual argument, then the new mapping must match one of the formats specified in the range directive.
A dummy argument whose associated actual argument has the DYNAMIC attribute may be used in REALIGN and REDISTRIBUTE as an alignee or distributee if and only if the associated actual argument is a whole array, not an array section.
If the actual argument associated with the dummy has not been declared DYNAMIC then the original mapping of the actual has to be restored on return. When the subprogram returns and the caller resumes execution, all objects accessible to the caller after the call that are not declared DYNAMIC are mapped exactly as they were before the call.
MODULE FOO REAL A(10,10) !HPF$ DYNAMIC :: A END PROGRAM MAIN USE FOO CALL SUB(A(1:5,3:9)) END SUBROUTINE SUB(B) USE FOO REAL B(:,:) !HPF$ DYNAMIC :: B ... !HPF$ REDISTRIBUTE A !Nonconforming ... END
Situations such as this are forbidden, for the same reasons that an assignment to A at the statement marked ``Nonconforming'' would also be forbidden. In general, in any situation where assignment to a variable would be nonconforming by reason of aliasing, remapping of that variable by an explicit REALIGN or REDISTRIBUTE directive is also forbidden.
Note that it is permitted to remap a host-associated or use-associated variable in a subprogram if it has been declared DYNAMIC and is accessible only through a single path. Such remappings stay in effect even after the subprogram has returned to its caller.