To: J3 J3/18-244 From: Van Snyder Subject: Irregularities (associate names) Date: 2018-September-13 Introduction ============ To reduce surprises, especially for newcomers to Fortran, it would be helpful if facilities that have similar purposes had similar details. The example under attention here is associate names of ASSOCIATE constructs. The relationship between selectors and associate names in ASSOCIATE constructs was consciously modeled on the relationship between actual and dummy arguments. An unexpected difference is that an allocatable actual argument can correspond to an allocatable dummy argument, and a pointer actual argument can correspond to a pointer dummy argument, but an associate name never has the ALLOCATABLE or POINTER attribute. Unlike a dummy argument, there is at present no way to attach either the ALLOCATABLE or POINTER attribute to an associate name. An effect of this is that the associate name cannot be allocated or deallocated, the allocation of an associate name cannot be moved, and the pointer association status of an associate name cannot be nullified, even if the selector is allocatable or a pointer. An associate name cannot be the target of a pointer assignment unless the selector has the POINTER or TARGET attribute. Unlike a dummy argument, there is at present no way to attach the TARGET attribute to an associate name. Proposal ======== Extend the similarity of the relationship of associate names to selectors, to be more like the relationship between dummy and actual arguments. Allow at least a limited form of that can specify the ALLOCATABLE or POINTER attribute for an associate name, which, if it appears, shall correspond to the attribute of the selector. Whether it should be allowed to specify the TARGET attribute for an associate name independently of whether the selector has the attribute, with the same caveats that apply to actual and dummy arguments, deserves more discussion. It might subvert optimizers. One way to make it reasonable is to specify that any pointers that appear in a pointer association context, that might be involved with associate names, become undefined (even better, nullified) when execution of the construct completes. This would include the case of a pointer actual argument corresponding to a dummy argument that is not known to have INTENT(IN). More generally, allow a in an ASSOCIATE construct, with the restriction that the only attribute that can be specified for an associate name is the ALLOCATABLE or POINTER attribute (and maybe the TARGET attribute).