08-222r3 To: J3 From: Van Snyder, originally Michael Ingrassia Subject: Public Comment J32008 Date: 2008 August 15 ---------------------------------------------------------------------- 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. The program should print 1.0 because 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. An edit is supplied to clarify this. [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.