This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Compiler error with local procedure pointers of same name


gfortran errors out on the code below, which I believe is valid. It appears to confuse two different local procedure pointers that have the same name for a global procedure pointer that is used inconsistently as both a function and a subroutine.

-- John


MODULE m


IMPLICIT NONE

CONTAINS

  FUNCTION func(x) RESULT(y)
    INTEGER :: x,y
    y = x *2
  END FUNCTION func

  SUBROUTINE sub(x)
    INTEGER :: x
    PRINT*, x
  END SUBROUTINE sub


SUBROUTINE use_func() PROCEDURE(func), POINTER :: f INTEGER :: y f => func y = f(2) END SUBROUTINE use_func

  SUBROUTINE use_sub()
    PROCEDURE(sub), POINTER :: f
    f => sub
    CALL f(2)
  END SUBROUTINE use_sub

END MODULE m


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]