08-222r1 To: J3 From: Van Snyder, originally Michael Ingrassia Subject: Public Comment J32008 Date: 2008 August 11 ---------------------------------------------------------------------- Commenter: Robert Corbett Subject: "generic resolution" Consider the program PROGRAM MAIN INTERFACE COS REAL FUNCTION MYCOS(X) END FUNCTION END INTERFACE CALL SUBR CONTAINS SUBROUTINE SUBR INTRINSIC COS PRINT *, COS(0.0) END SUBROUTINE END REAL FUNCTION MYCOS(X) MYCOS = 2.0 END When compiled using the compilers provided by Sun, Cray, Intel, HP, and PathScale, the program prints 2.0. When compiled using the compilers provided by IBM, NAG, and GCC, the program prints 1.0. Interpretations 90/000082 and 90/000086 require the latter interpretation. Text should be added to the standard itself clarifying this point. ---------------------------------------------------------------------- J3 response: Neither interpretation F90/000082 nor F90/000086, at least according to http://j3-fortran.org/doc/archive/standing/006/96-006r2/96-006r2.b080, mention the INTRINSIC attribute, and therefore do not appear to be germane. 12.5.5.2p1 and 12.5.5.2p2 do not apply because the generic interface block is not (defined) in the internal subroutine. Although neither paragraph includes the word "defined", the fact that host association is mentioned in 12.5.5.2p4 makes it clear that the generic name is not accessed from the host scoping unit, notwithstanding 16.5.1.5p2-3. The relationship between 12.5.5.2 and 16.5.1.5 should perhaps be clarified at a later time. 12.5.5.2p3 specifies that the intrinsic COS is referenced when 12.5.5.2p1-2 do not apply, and they do not apply in this case. Edits are supplied to clarify this. 12.4.3.4.5p5 concerns resolving references to generic identifiers, simply restating the result of 12.5.5.2, and as such does not belong in 12.4.3.4.5. An edit is supplied to move this paragraph to 12.5.5.2, making it a note. [N1723:299:12.5.5.2p1-2] Editor: Insert "defined" after "either is" twice, to make it clear that host association is not under consideration. [N1723:300:Note 12.41+] Editor: Move 12.4.3.4.5p5 to be a new NOTE 12.41+. We probably should keep this paragraph somewhere since it was inserted by interpretation F90/000083.