Using module procedure names that collide with the GNU intrinsic extensions
is not possible even with -std=f95:

ale...@novo:~/$ gfortran -c -std=f95 p.f90
p.f90:19.19:

      print *, avg(erfc)
                  1
Error: Intrinsic 'erfc' at (1) is not allowed as an actual argument
p.f90:19.19:

      print *, avg(erfc)
                  1
Error: Type/rank mismatch in argument 'f' at (1)

================ p.f90 ================
! NO: program p -- passing internal procedures                                  
!                  as actual args is not allowed                                
module p ! -- passing module procedure IS allowed                               
  implicit none                                                                 

! call test()

  contains

    subroutine test()
      implicit none
      ! *** end of interface ***

      intrinsic sqrt
      intrinsic dsqrt

    ! print *, avg(sqrt)
      print *, avg(dsqrt)
      print *, avg(erfc)
    end subroutine test

    function avg(f) result(r)
      implicit none
      double precision :: r
      interface
        double precision function f(x)
          implicit none
          double precision, intent(in) :: x
        end function f
      end interface
      ! *** end of interface ***

      r = ( f(1.0D0) + f(2.0D0) ) / 2
    end function avg

    function erfc(x) result(r)
      implicit none
      double precision, intent(in) :: x
      double precision             :: r
      ! *** end of interface ***

      r = x
    end function erfc

end ! module/program


-- 
           Summary: module procedure name that collides with the GNU
                    intrinsic
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alexei dot matveev+gcc at gmail dot com


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

Reply via email to