Here, the proc-pointer result is passed as actual argument to a procedure which does not want to have the pointer but the pointer target.
There are two problems: The first program shows wrong code: sub (void (*<T3c5>) (integer(kind=4) &) f) but passed is: void (*<T3c5>) (integer(kind=4) &) D.1559; D.1559 = getptr (); sub (&D.1559); Result: A segmentation fault. The second program shows that the argument conformance checking goes wrong: call sub(getPtr()) 1 Error: Type mismatch in argument 'f' at (1); passed UNKNOWN to INTEGER(4) Problem found when writing a test case for PR 40580. Please add also an -fcheck=pointer test (assuming that PR 40580 gets checked in earlier) - I have a test there, but it needs to be enabled !------------ ONE ------------------- module m contains subroutine func(a) integer :: a a = 42 end subroutine func end module m program test use m implicit none call sub(getPtr()) contains subroutine sub(f) procedure(func) :: f integer :: a call f(a) if (a /= 42) call abort() print *, a end subroutine sub function getPtr() procedure(func), pointer :: getPtr getPtr => func end function getPtr end program test !------------ TWO ------------------- module m contains function func() integer :: func func = 42 end function func end module m program test use m implicit none procedure(integer), pointer :: ptr call sub(getPtr()) contains subroutine sub(f) procedure(integer) :: f if (f() /= 42) call abort() print *, f() end subroutine sub function getPtr() procedure(func), pointer :: getPtr getPtr => func end function getPtr end program test -- Summary: Proc-pointer returning function as actual argument Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: wrong-code, rejects-valid 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=40593