J3/01-149 Date: 01 March 2001 To: J3 From: Malcolm Cohen Subject: Revised interp 000028 ---------------------------------------------------------------------- NUMBER: 000028 TITLE: Implicitly Typed Statement Function Character Dummy KEYWORDS: statement function, constant expression, implicit typing DEFECT TYPE: Clarification STATUS: J3 consideration in progress QUESTION: Is the following program-unit standard-conforming? SUBROUTINE sub(n) IMPLICIT CHARACTER*(n) (c) stmtfn(ch) = LEN(ch) END A quick survey of 6 compilers showed no consensus on whether this was legal, with 3 accepting it (as standard-conforming), 2 rejecting it, and 1 crashing with an internal error. The standard seems to say (middle of section 5.1.1.5, [51:32-33]) that if you explicitly specify the length then it must be a constant specification expression, but does not appear to constrain implicit lengths. ANSWER: No, the example is not standard-conforming. DISCUSSION: The quoted section of the standard says: "The length specified for a ... statement function dummy argument of type character shall be a constant specification expression." The first paragraph of 5.3 says "In a scoping unit, an IMPLICIT statement specifies a type, and possibly type parameters, for all implicitly typed data entities ..." Therefore the requirement that the character length of a statement function or statement function dummy argument be constant applies to implicitly typed entities as well as explicitly typed entities. EDIT: None. SUBMITTED BY: Malcolm Cohen HISTORY: 98-164 m145 Submitted 01-149 m156 Revised ----------------------------------------------------------------------