J3/13-305 To: J3 From: Van Snyder Subject: Interp concerning the IMPORT statement Date: 2013 August 13 ---------------------------------------------------------------------- NUMBER: TBD TITLE: IMPORT statement and prior explicit declaration KEYWORD: IMPORT statement, prior explicit declaration DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTIONS: Does the following program fragment conform to the 2008 standard? module M interface subroutine Q ( X ) real, intent(inout) :: X end subroutine Q end interface end module M subroutine S ( P ) use M interface subroutine P ( A ) import procedure (R) :: A end subroutine P end interface procedure (Q) :: R end subroutine S 12.4.3.3p2 says "If an entity that is made accessible by this means is accessed by host association and is defined in the host scoping unit, it shall be explicitly declared prior to the interface body." The external procedure R, and therefore its explicit specific interface, are accessed by host association within the interface body, but neither one is defined in the host scoping unit. Therefore, this fragment appears to conform. A similar question would be raised concerning 12.4.3.3p1 if the IMPORT statement were "import :: R", or if subroutine S were a module procedure within module M instead of accessing module M by use association. ANSWER: Since R is declared, but not defined, within the host scoping unit of the interface body, albeit after the interface body, the program fragment does conform to the 2008 standard. It was intended that such forward references do not conform. Edits are provided to correct this defect. EDITS: [12.4.3.3p1 282:7-8] Replace "An entity that is imported in this manner and is defined in the host scoping unit shall be explicitly declared prior to the interface body" with "If an entity that is made accessible by this means is accessed by host association, it shall be accessible by use or host association in the host scoping unit, or explicitly defined or declared prior to the interface body". {Revised wording is parallel to revised 12.4.3.3p2 (below), instead of being confusingly dissimilar.} [12.4.3.3p2 282:13-15] Replace "If an entity that is made accessible by this means is accessed by host association and is defined in the host scoping unit, it shall be explicitly declared prior to the interface body" with "If an entity that is made accessible by this means is accessed by host association, it shall be accessible by use or host association in the host scoping unit, or explicitly defined or declared prior to the interface body". SUBMITTED BY: Van Snyder HISTORY: m202 13-xxx Submitted ----------------------------------------------------------------------