Mixing functions and subroutines in a generic interface is invalid. gfortran
detects this but the error message is difficult to understand:

Error: FUNCTION at (1) does not belong in a generic subroutine interface

NAG f95:
Error: b.f90, line 10: BAR and SUB must both be SUBROUTINEs or both be
FUNCTIONs for generic GEN

g95:
Error: Interfaces of generic 'gen' at (1) must all be FUNCTIONs or SUBROUTINEs

ifort -stand f95:
fortcom: Warning: b.f90, line 6: Standard Fortran requires that within a
scoping unit, two procedures that have the same generic name shall both be
subroutines or both be functions.   [BAR]

Example:

module mod
  implicit none
  interface gen
    subroutine sub()
    end subroutine sub
    function bar()
      real :: bar
    end function bar
  end interface gen
end module mod


-- 
           Summary: Improve error message for generic interface with
                    subroutines & functions
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33117

Reply via email to