gfortran question regarding dummy procedures

Roger Ferrer Ibáñez rofirrim@gmail.com
Mon Mar 23 13:50:00 GMT 2015


Hi,

in the following Fortran code

PROGRAM MAIN
    EXTERNAL :: FOO
    INTERFACE
        SUBROUTINE S1(P1)
            INTERFACE
                FUNCTION P1(X)
                    INTEGER :: P1
                    INTEGER :: X1
                END FUNCTION P1
            END INTERFACE
        END SUBROUTINE S1

        SUBROUTINE S2(P2)
            INTERFACE
                FUNCTION P2(X)
                   REAL :: P2
                   REAL :: X
                END FUNCTION P2
            END INTERFACE
        END SUBROUTINE S2
    END INTERFACE

    CALL S1(FOO)  ! <-- why is this allowed?
    CALL S2(FOO)
END PROGRAM MAIN

why is gfortran (tested with 4.9.1) allowing the call to S1? FOO has a
REAL implicit type so it looks to me that it cannot match the
characteristics of P1.

Am I wrong or this is a gfortran bug?

Kind regards,

-- 
Roger Ferrer Ibáñez



More information about the Gcc-help mailing list