J3/06-376r1 To: J3 From: Malcolm Cohen Subject: NAMELIST, EQUIVALENCE, SAVE and BLOCK Date: 2006/11/15 1. Introduction This paper proposes fixing problems and confusions caused by the potential use of NAMELIST, EQUIVALENCE, SAVE in BLOCK constructs. 2. Problems For NAMELIST, there is a similar problem as for COMMON, in that all the NAMELIST statements in a scoping unit contribute to that namelist. That is either confusing and hard to explain (if the ones inside BLOCK don't) or error-prone and weird (if they do). Therefore, we should require that all the NAMELIST statements be in the specification part of the subprogram, not inside any BLOCK. Similar confusions arise for EQUIVALENCE, since the equivalence-sets are glommed together from all the overlapping ones in a scoping unit. Again, this would either be confusing and hard to explain, or confusing and weird. And since COMMON is not allowed in BLOCK, we need to address EQUIVALENCE somehow otherwise we could extend the COMMON in the BLOCK! Slightly different problems arise for SAVE. Certainly a global SAVE should not be allowed in a BLOCK construct. It would seem useful to allow the SAVE attribute to be specified for individual BLOCK-local variables, but the description of the SAVE attribute is currently defective there. 3. Solutions Prohibit NAMELIST from BLOCK. Prohibit EQUIVALENCE from BLOCK. Prohibit global SAVE from BLOCK. Fix the description of the SAVE attribute to cover BLOCK entry/exit. 4. Edits [97:17] "variable" -> "local variable of a program unit or subprogram" {Exclude BLOCK-local variables from this definition.} [97:19] after "local variable of a subprogram" insert "or BLOCK construct" {Shared with all instances.} [97:20] Append to paragraph "The SAVE attribute specifies that a local variable of a BLOCK construct retains its association status, allocation status, definition status, and value after termination of the construct unless it is a pointer and its target becomes undefined (16.5.2.2.3(4))." {Mutated version for BLOCK-local variables.} [177:21] Insert into list "NAMELIST statement, EQUIVALENCE statement, SAVE statement with no " {Prohibit these statements from appearing in a BLOCK construct.} [177:21+] Insert new constraint "C8xx A SAVE statement in a BLOCK construct shall not specify a ." ===END===