J3/99-178
Date: 1999/07/12
To: J3
From: Henry Zongaro
Subject: Interpretation request on constant spec. expressions
NUMBER:
TITLE: Asymmetry between constant specification and initialization expressions
KEYWORDS: Initialization expressions; specification expressions
DEFECT TYPE:
STATUS:
QUESTION:
Consider the following programs.
PROGRAM P1
INTEGER :: A(INT(4*ATAN(1.0))) = 17
PRINT *, A
END PROGRAM P1
PROGRAM P2
REAL, PARAMETER :: B = 4.0*ATAN(1.0)
PRINT *, B
END PROGRAM P2
My reading of 7.1.6.1 is that program unit P2 is not standard-conforming.
Items (4), (5), (6) and (7) under the description of initialization expressions
deal with references to intrinsic functions in initialization expressions.
Item (4) permits "elemental intrinsic function references of type integer or
character" in initialization expressions; ATAN is elemental, but does not fall
in that category. Items (5)-(7) permit references to various transformational
and inquiry functions in initialization expressions; ATAN does not fall into
either of those categories.
My reading of 7.1.6.2 together with 7.1.6.1 is that program unit P1 is
standard-conforming. Item (8) in 7.1.6.2 permits a "reference to any other
intrinsic function defined in this standard where each argument is a
restricted expression" to appear in a restricted expression. Clearly,
ATAN(1.0) is a restricted expression. According to item (4) under constant
expression in 7.1.6.1, "An elemental intrinsic function reference where each
argument is a constant expression" is a constant expression. Clearly,
ATAN(1.0) is a constant expression. Thus INT(4*ATAN(1.0))) is a constant
specification expression.
Was it the committee's intent to permit ATAN to appear in constant
specification expressions but not in initialization expressions?
ANSWER:
EDIT:
SUBMITTED BY: Henry Zongaro
HISTORY: 99-178 m150 submitted