-rule
to to is [ prefix ] SUBROUTINE subroutine-name subroutine-stuff
subroutine-stuff -to -rule
to to is [ ( [ dummy-arg-list ] ) ]
XBNF
- A prefix must contain at most one of each variety of
prefix-spec.
- The prefix of a subroutine-stmt must not contain a
type-spec.
- The specification-part of a pure function must
specify that all dummy arguments have INTENT(IN) except procedure
arguments and
arguments with the POINTER attribute.
- A local variable declared in the specification-part or
internal-subprogram-part of a
pure function must not have the
SAVE attribute.
- []Advice to users.
Note local variable initialization in a type-declaration-stmt or a data-stmt implies the SAVE
attribute; therefore, such initialization is also disallowed.
(End of advice to users.)
- The execution-part and internal-subprogram-part
of a pure function may not use a dummy
argument, a global variable,
or an object that is storage associated with a global variable, or a
subobject thereof, in the following contexts:
- As the assignment variable of an assignment-stmt;
- As a DO variable or implied DO variable, or as an
index-name in a forall-triplet-spec;
- As an input-item in a read-stmt;
- As an internal-file-unit in a write-stmt;
- As an IOSTAT= or SIZE= specifier in an
I/O statement.
- In an assign-stmt;
- As the pointer-object or target of a pointer-assignment-stmt;
- As the expr of an assignment-stmt whose
assignment variable is of a derived type, or is a pointer to a derived
type, that has a pointer component at any level of component selection;
- As an allocate-object or stat-variable in an
allocate-stmt or deallocate-stmt, or as a pointer-object in a nullify-stmt; or
- As an actual argument associated with a dummy argument with
INTENT (OUT) or INTENT(INOUT) or with the POINTER
attribute.
- Any procedure referenced in a pure function, including one referenced
via a defined operation or assignment, must be pure.
- A dummy argument or the dummy result of a pure function may
be explicitly aligned only with another dummy argument or the dummy
result, and may not be explicitly distributed or given the
INHERIT attribute.
- In a pure function, a local variable may be explicitly aligned only
with another local variable, a dummy argument, or the result variable.
A local variable may
not be explicitly distributed.
- In a pure function, a dummy argument, local variable, or the result variable
must not have the DYNAMIC attribute.
- In a pure function, a global variable must not appear in
a realign-directive or redistribute-directive.
- A pure function must not contain a
backspace-stmt,
close-stmt,
endfile-stmt,
inquire-stmt,
open-stmt,
print-stmt,
rewind-stmt,
or a read-stmt or write-stmt whose
io-unit is an external-file-unit or *.
- A pure function must not contain a pause-stmt or
stop-stmt.
- The specification-part of a pure subroutine must specify
the intents of all dummy arguments except procedure arguments and
arguments that have the POINTER attribute.
- A local variable declared in the specification-part or
internal-function-part of a pure subroutine must not have the
SAVE attribute.
- The execution-part or internal-subprogram-part of
a pure subroutine must not use a dummy parameter with INTENT(IN),
a global variable, or an object that is storage associated with a
global variable, or a subobject thereof, in the following contexts:
- As the assignment variable of an assignment-stmt;
- As a DO variable or implied DO
variable, or as a index-name in a forall-triplet-spec;
- As an input-item in a read-stmt;
- As an internal-file-unit in a write-stmt;
- As an IOSTAT= or SIZE= specifier in
an I/O statement.
- In an assign-stmt;
- As the pointer-object or target
of a pointer-assignment-stmt;
- As the expr of an assignment-stmt
whose assignment variable is of a derived type, or is a
pointer to a derived type, that has a pointer component
at any level of component selection;
- As an allocate-object or stat-variable in an allocate-stmt or deallocate-stmt, or as a pointer-object in a
nullify-stmt;
- As an actual argument associated with a dummy
argument with INTENT (OUT) or INTENT(INOUT)
or with the POINTER attribute.
- Any procedure referenced in a pure subroutine, including one
referenced via a defined operation or assignment, must be pure.
- A dummy argument of a pure subroutine may be explicitly aligned
only with another dummy argument, and may not be explicitly
distributed or given the INHERIT attribute.
- In a pure subroutine, a local variable may be explicitly aligned
only with another local variable or a dummy argument. A local variable
may not be explicitly distributed.
- In a pure subroutine, a dummy argument or local variable must not
have the DYNAMIC attribute.
- In a pure subroutine, a global variable must not appear in a realign-directive or redistribute-directive.
- A pure subroutine must not contain a
backspace-stmt,
close-stmt,
endfile-stmt,
inquire-stmt,
open-stmt,
print-stmt,
rewind-stmt,
print-stmt,
or a read-stmt or write-stmt whose
io-unit is an external-file-unit or *.
- A pure subroutine must not contain a pause-stmt or
stop-stmt.
- An interface-body of a pure procedure must specify
the intents of all dummy arguments except POINTER and procedure
arguments.
- In a reference to a pure procedure, a procedure-name
actual-arg must be the name of a pure procedure.
Next: The INDEPENDENT Directive
Up: Data Parallel Statements
Previous: The FORALL Construct