(j3.2006) Public Comment J32016

Michael Ingrassia michaeli
Tue Jul 8 20:24:21 EDT 2008


                                                            08-230
To: J3
From: Michael Ingrassia
Subject: Public Comment J32016
Date: 2008 July 08
----------------------------------------------------------------------

Commenter's Subject was "advice regarding additional intrinsics ignores"

The advice given in paragraph 4 of Section 1.4 of the
Fortran 2008 ignores a important issue that affects
portability.  Consider the program

       PROGRAM MAIN
         INTERFACE SQRT
           INTEGER FUNCTION NISQRT(I)
           END FUNCTION
         END INTERFACE
         CALL SUBR
       CONTAINS
         SUBROUTINE SUBR
           INTRINSIC SQRT
           PRINT *, SQRT(4)
           PRINT *, SQRT(4.0)
         END SUBROUTINE
       END

       INTEGER FUNCTION NISQRT(I)
         NISQRT = -INT(SQRT(REAL(I)))
       END

A user might expect that program to write something like

  -2
  2.0

If, however, the implementation provides a specific
interface for SQRT that takes an argument of type INTEGER,
that interface will be chosen over the user's external
function according to the rules presented in
Section 12.5.5.2 of the Fortran 2008 draft.

I suggest adding a warning against declaring a name to have
the INTRINSIC attribute in a context where that name is
accessible as the name of a generic interface.

----------------------------------------------------------------------



More information about the J3 mailing list