Found while looking at PR 39997. The following is not checked. The reason is that the check contains:
if (rvalue->expr_type == EXPR_VARIABLE while the example has EXPR_FUNCTION program test procedure(real), pointer :: p p => f() ! << Invalid f() returns a LOGICAL(1) function, but p is a REAL one contains function f() pointer :: f interface logical(1) function f() end function end interface f = .true._1 end function f end program test * * * Maybe PR 39997 (comment 3) item 3 can be fixed at the same time. One needs just to add: If( RHS is a function && LHS is untyped) { implicitly type proc pointer on the LHS } before the subroutine/function check is done. -- Summary: Assignment checking for proc-pointer => proc-ptr- returning-function() Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: accepts-invalid 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=40541