PURE attribute

Standard: F77 F90 F95 F2003 F2008 F2018 Example program



The PURE keyword may appear only in the prefix of a FUNCTION or SUBROUTINE statement.


The PURE keyword specifies that all procedures defined by this subprogram are “pure”; that is, they have no side effects. (A subprogram can define several procedures by using the ENTRY statement.) A pure procedure can thus be used safely in contexts where side-effects are problematic; that is, in specification expressions and in DO CONCURRENT and FORALL constructs.

A pure subprogram must obey the following rules:

The PURE attribute is also implied by the ELEMENTAL attribute, except when ELEMENTAL is accompanied by the IMPURE attribute.


DO CONCURRENT construct, ELEMENTAL attribute, ENTRY statement, FORALL construct, FUNCTION statement, IMPURE attribute, SUBROUTINE statement