J3/08-156 To: J3 From: Van Snyder Subject: Attrributes, especially the EXTERNAL attribute Date: 2008 April 23 [87: 5.3.1p1] ---------------------------------------------------------- [87: 5.3.1p1] appears to specify how attributes are specified, but the EXTERNAL attribute may also be explicitly specified by an interface body or by a procedure declaration statement. Also, the EXTERNAL attribute specification statement is in 12.4.3.5, not 5.4. Editor: Insert "for a data entity" before "may be". Editor: Delete the final sentence because it's just fluff. [87: 5.3.1 C515] ------------------------------------------------------- This ought to be a constraint on R515 [92: 5.3.8.1] since the only attribute it constrains is the DIMENSION attribute. Editor: Move C515 to be a constraint on R515 [92: 5.3.8.1]. [87: 5.3.1 C516] ------------------------------------------------------- I would be more comfortable if this were a constraint on R1229 or R1230 (preferably R1230) [302: 12.6.2.2]. Editor: Choose whether to leave it or move it, and if moved choose where. [94: 5.3.9p1+]---------------------------------------------------------- Editor: Insert the following as a new paragraph after [94: 5.3.9p1]. "The EXTERNAL attribute may be explicitly specified by an in a type declaration statement, an EXTERNAL statement (12.4.3.5), an interface body that is not an abstract interface body or a module procedure interface body (12.4.3.2), or a procedure declaration statement (12.4.3.6). The EXTERNAL attribute for a block data subprogram shall only be specified by an EXTERNAL statement." It could be in 5.3.1p1, but it applies only to the EXTERNAL attribute, not all attributes. I have a recollection, but couldn't find where it's specified, that an external procedure has the EXTERNAL attribute within its own scoping unit. Does it? Where does it say so? Is it implicit or explicit? Does a function without a separate result name have the EXTERNAL attribute within its own scoping unit? If so, these should be specified in 5.3.9p1+. If we were to say "Except for a function that has the same result name as its function name, an external procedure definition explicitly specifies the EXTERNAL attribute for that procedure within the scoping unit of the subprogram that defines it" we woudn't need C538 because C514 would cover it, and we wouldn't need "its interface shall be explicit or" in 12.5.2.9p4. [94: 5.3.9p2]----------------------------------------------------------- The material in 5.3.9p2 is misplaced and incomplete. The parts of 5.3.9p2 relating to actual arguments have nothing to do with what the EXTERNAL attribute is, and are better covered in 12.5.2.9p4 ("12.5.2.9 Actual arguments ...") , which is the correct place. Although 5.3.9p2 does not include "explicit" in its requirement, it might be construed to exclude the case of passing an external procedure name as an actual argument from within its own scoping unit because explicit declaration of the EXTERNAL attribute would contradict C538. 12.5.2.9p4 clearly allows it by saying "or explicit interface," which also makes it clear (well, clear after a trivial theorem is proved) that a function that has a result variable name that is the same name as the function name cannot be an actual argument associated with a dummy procedure. I have a recollection, but can't find where it's specified, that the EXTERNAL attribute is implicitly specified by a CALL statement or a function reference. If so, then 5.3.9p2 allows a procedure that implicitly acquires the EXTERNAL attribute to be an actual argument associated with a dummy procedure, but 12.5.2.9p4 clearly prohibits it ("... shall be explicitly declared to have the EXTERNAL attribute"). Does resolving this contradiction require an interp, or has there already been one, or is this a long-gone never-standard extension allowed by some early Fortran compilers? The parts relating to pointer assignment have nothing to do with what the EXTERNAL attribute is, and are (mostly) implied by C731 in 7.2.2 ("Pointer assignment"), which is the correct place. Editor: Delete 5.3.9p2. [157: 7.2.2.2 C731] ---------------------------------------------------- Editor: To impose the same restrictions on procedure pointer targets as on actual arguments associated with dummy procedures, which we clearly intended but didn't do correctly in 5.3.9p2, add a new sentence at the end of C731: "If is the name of an external or dummy procedure, the procedure shall have explicit interface, or explicitly have the EXTERNAL attribute, within the scoping unit where the appears." Unlike the case of actual arguments, I think we can do this in a constraint. Otherwise, add the sentence as a new sentence after [158: 7.2.2.4p7]. [277: 12.4.3.2p5] ------------------------------------------------------ Editor: Delete "the EXTERNAL attribute and" because that's now covered by the new 5.3.9p2. [294: 12.5.2.9p4] ------------------------------------------------------ Editor: Delete "name" twice because it's the entity, not the name, that has the explicit specific interface or the EXTERNAL attribute. Insert a comma after "explicit". Replace "be explicitly declared to" by "explicitly" (so the next edit works in the presence of host association). At the end of the paragraph append ", within the scoping unit where the procedure reference apprears".