J3/99-216 Date: 1999/07/12 To: J3 From: /DATA Subject: Interpretation request 70 on constant spec. expressions NUMBER: 000070 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: This asymmetry was unintended. These expressions should have been described as initialization expressions instead of as constant expressions; the edits below correct this. EDIT: [39:15] Change "a constant specification" to "an initialization". {Fix array components} [39:23] Change "a constant specification" to "an initialization". {Fix character string components} [40:30] Change "a constant" to "an initialization". {Fix note} [48:47-48] Change "may be a nonconstant expression provided the specification expression" to "shall be an initialization expression unless it". [49:1-3] Delete "If a ... nonconstant expression." [49:4-5] Change "such a nonconstant expression" to "a that is not an initialization expression". {Fix definition of "automatic object"} [49:9] Change "a nonconstant expression" to "an expression that is not an initialization expression". {Fix evaluation time for character length} [51:33] Change "a constant specification" to "an initialization". {Fix statement function character lengths} [54:33] Change "nonconstant specification" to "not initialization". {Fix automatic array definition} [54:34] Change "nonconstant specification" to "not initialization". {Fix evaluation time for explicit-shape array bounds} [56:32] Change "nonconstant specification" to "not initialization". {Fix evaluation time for assumed-size array bounds} [69:3-4] Change "a constant specification expression (7.1.6.2)" to "an initialization expression (7.1.6.1)". {Fix common block array-specs} SUBMITTED BY: Henry Zongaro HISTORY: 99-178 m150 submitted 99-216 m150 proposed answer