https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77596

            Bug ID: 77596
           Summary: [F03] procedure pointer with implicit interface in
                    type pointing to a function can be 'called'
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: t.kondic at leeds dot ac.uk
  Target Milestone: ---

Hi,

I guess that in an ideal world, the compiler should generate code to cause a
run-time error in a situation like in the following snippet:


!!*** CODE ***

module proctest
  implicit none
  type tf
     procedure(), nopass, pointer :: fp
  end type tf

contains
  function ff(x)
    integer, intent(in) :: x
    integer :: ff
    print *, 'aaaa'
  end function ff


  subroutine ass()
    type(tf) :: p

    p%fp=>ff
    call p%fp(3)
  end subroutine ass

end module proctest


program xxx
  use proctest
  call ass()
end program xxx

!!*** END CODE ***

In subroutine 'ass', I am assigning a function to the procedure pointer. Next,
I am able to call the function pointer like a subroutine, using 'call'
statement,  with no consequences.

Reply via email to