To: J3 J3/18-250 From: Jon Steidel Subject: Interp: SELECT RANK associate names in variable definition contexts Date: 2018-September-13 NUMBER: F18/xxxx TITLE: SELECT RANK associate names in a variable definition context KEYWORDS: assumed-rank, SELECT RANK, associate name DEFECT TYPE: TBD STATUS: New QUESTION: Can a SELECT RANK associate name appear in a variable definition context of a RANK (scalar-int-const-expr) or a RANK (*) rank case block? Consider the following procedure: SUBROUTINE example (assumed_rank) REAL,DIMENSION(..) :: assumed_rank SELECT RANK (assoc_name => assumed_rank) RANK (0) ! assoc_name is scalar assoc_name = 0.0 ! legal? RANK (*) ! assoc_name is rank 1, DIMENSION(1:*) assoc_name = 1.0 ! legal? RANK DEFAULT ! assoc_name is assume_rank assoc_name = -1.0 ! not legal END SELECT END SUBROUTINE The rules in 11.1.10.3 state that assoc_name is scalar (RANK 0) in the RANK (0) block. In the RANK (*) rank case block, assoc_name is rank 1, assumed size with DIMENSION(1:*). In the RANK DEFAULT rank case block, assoc_name is assumed rank. Constraint C838 restricts usage of an assume-rank object; it cannot be used in a variable definition context. Thus, the assignment in the RANK DEFAULT rank case block is not legal. In section 11.1.10.4 Examples of SELECT RANK construct, note 1 indicates the assignments in the RANK(0) and RANK(*) rank case blocks are legal. Paragraph 5 of section 11.1.3.3 states "The associating entity is itself a variable, but if the selector is not a definable variable, the associating entity is not definable and shall not be defined or become undefined. If a selector is not permitted to appear in a variable definition context, neither the associate name or any subobject thereof shall appear in a variable definition context." A selector in a SELECT RANK construct must be assumed rank per constraint C1150. An assumed rank array is not permitted in a variable definition context. The words of 11.1.3.3 indicate the assignments in the RANK (0) and the RANK (*) blocks, and the first example in 11.1.10.4 to be non-conforming. ANSWER: EDITS to xx-007: SUBMITTED BY: Jon Steidel HISTORY: