https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88438
Bug ID: 88438 Summary: A pointer function reference can denote a variable in any variable definition context. Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: juergen.reuter at desy dot de Target Milestone: --- Apparently this feature of F2008 is still flagged as unimplemented in the F2008 chart on the gfortran wiki page. Today there was a discussion on the Intel Forum, https://software.intel.com/en-us/comment/1930834#comment-1930834 that the following code is valid F2008, but not valid F2003, because the selector is a function reference with a data pointer result. I think this should be marked as an item in the chart here https://gcc.gnu.org/wiki/Fortran2008Status with a red "No" status. The code discussed in that Intel forum is repeated here: module mod implicit none private public get public inc type, public :: t integer :: i = 5 end type t contains function get(x) result(p) integer, pointer :: p type(t), target, intent(in) :: x p => x%i end function get subroutine inc(i) integer, intent(inout) :: i i = i + 1 end subroutine inc end module mod program assoc_func_intent use mod implicit none type(t) :: x print *,x%i associate(p => get(x)) call inc(p) end associate print *,x%i end program assoc_func_intent