(j3.2006) Whose bug is it?

Bill Long longb
Wed Mar 5 12:33:10 EST 2008


I tried the program on 4 compilers (not including SUN).  2 gave an 
error, and 2 did not complain.

I think that issuing the error is valid.  Generic interfaces merge 
together their lists of specifics when more than one with the same 
generic name is visible.  Whether that visibility comes through host 
association or use association should not matter.  Craig's citation from 
f03 explicitly says "nongeneric" intentionally, and does not apply in 
this case.

Cheers,
Bill


Robert Corbett wrote:
> 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
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>   

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list