(j3.2006) Whose bug is it?

Robert Corbett Robert.Corbett
Wed Mar 5 02:04:19 EST 2008


A user claims that of all the Fortran 95 compilers he has tried,
and he has a list, only Sun Fortran fails to compile the following
program:

       MODULE M1
         INTERFACE SUBR
           MODULE PROCEDURE SUBR1
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR1
         END SUBROUTINE
       END

       MODULE M2
         INTERFACE SUBR
           MODULE PROCEDURE SUBR2
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR2
         END SUBROUTINE
       END

       PROGRAM MAIN
         USE M1
         CALL S
       CONTAINS
         SUBROUTINE S
           USE M2
           CALL SUBR
         END SUBROUTINE
       END

Sun Fortran does fail to compile the program.  It gives the error
message

        USE M1
             ^
"test.f", Line = 20, Column = 6: ERROR: The specific interfaces for 
"SUBR1" and "SUBR2" make the GENERIC interface "SUBR" ambiguous.

The user seems to think that the definition imported by the USE
statement in the internal subroutine S should override the definition
imported by the USE statement that appears directly in the main
program.  I think he is wrong.  Am I overlooking something?

Bob Corbett



More information about the J3 mailing list