Note these restrictions:
A statement function must appear only after the specification statements and before the first executable statement of the program unit in which it is referenced.
A statement function is not executed at the point where it is specified. It is executed, as any other, by the execution of a function reference in an expression.
The type conformance between fun and e are the same as those for the assignment statement. The type of fun and e can be different, in which case e is converted to the type of fun.
The actual arguments must agree in order, number, and type with corresponding dummy arguments.
If a dummy argument is defined as a structure, the corresponding actual argument must be similarly defined as the same structure.
A dummy argument cannot be an array or function name, or have the same name as the function.
The same argument cannot be specified more than once in the argument list.
The statement function may be referenced only in the program unit that contains it.
The name of a statement function cannot be an actual argument. Nor can it appear in an EXTERNAL statement.
The type of the argument is determined as if the statement function were a whole program unit in itself.
Even if the name of a statement function argument is the same as that of another local variable, the reference is considered a dummy argument of the statement function, not the local variable of the same name.
The length specification of a character statement function or its dummy argument of type CHARACTER must be an integer constant expression.
A statement function cannot be invoked recursively.