12-174r1
To: J3
From: Malcolm Cohen (previously Tobias Burnus, revised by Van Snyder)
Subject: Pointer arguments to PURE functions
Date: 2012 October 16
----------------------------------------------------------------------
NUMBER: F08/0084
TITLE: Pointer arguments to PURE functions
KEYWORDS: PURE function, POINTER, INTENT(IN)
DEFECT TYPE: Erratum
STATUS: J3 consideration in progress
QUESTION:
Consider the following subprogram:
Real Pure Function F( X )
Real,Pointer :: X
Real :: F
f = 1.0
x = 2.0 ! (A)
Nullify(x) ! (B)
End Function F
This subprogram does not conform to Fortran 2003, because both
statements (A) and (B) violate constraint C1272 which says
"C1272 In a pure any designator with a base object that ...
is a dummy argument of a pure function ... shall not
be used ... [in] a variable definition context ...".
However, the corresponding constraint in Fortran 2008, C1283, is
missing the condition that applies the constraint to a dummy
argument of a pure function, except when has INTENT(IN). Thus
the statements marked (A) and (B) do not violate C1283, and
therefore this subprogram appears to conform to Fortran 2008.
Was this subprogram intended to be standard-conforming?
ANSWER:
No, this subprogram was not intended to be standard-conforming.
An edit is supplied to re-insert the omitted condition.
EDIT to 10-007r1:
[312:31] In 12.7, constraint C1283, after "association",
insert ", is a dummy argument of a pure function".
SUBMITTED BY: Tobias Burnus
HISTORY: 12-174 m199 Submitted
12-174r1 m199 Revised
----------------------------------------------------------------------