This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/64508] New: [F03] interface check missing for procedure pointer component as actual argument


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

            Bug ID: 64508
           Summary: [F03] interface check missing for procedure pointer
                    component as actual argument
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janus at gcc dot gnu.org

Inspired by the discussion at:

https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/svfanCGU2vU

Example code:


module m

   TYPE :: parent
   END TYPE parent

   TYPE, EXTENDS(parent) :: extension
     INTEGER :: extension_component = 0
      procedure(extension_proc), pointer :: ppc
   END TYPE extension

contains

   SUBROUTINE parent_proc(arg)
     CLASS(parent), INTENT(IN) :: arg
     PRINT *, 'I am parent_proc'
   END SUBROUTINE parent_proc

   SUBROUTINE extension_proc(arg)
     CLASS(extension), INTENT(IN) :: arg
     PRINT *, 'I am extension_proc'
     PRINT *, arg%extension_component
   END SUBROUTINE extension_proc

   SUBROUTINE some_proc(proc)
     PROCEDURE(parent_proc) :: proc
     TYPE(Parent) :: a
     CALL proc(a)
   END SUBROUTINE some_proc

end module

program test
  use m
   CLASS(extension), ALLOCATABLE :: x
   procedure(parent_proc), pointer :: ppp
   procedure(extension_proc), pointer :: ppe

   CALL some_proc(parent_proc)     ! ok
   CALL some_proc(extension_proc)  ! interface mismatch

   ppp => extension_proc           ! interface mismatch
   call some_proc(ppp)

   ppe => extension_proc
   call some_proc(ppe)             ! interface mismatch

   allocate(x, source= Extension(666,extension_proc))
   CALL some_proc(x%ppc)           !  XXX: mismatch not detected
end



As the above example shows, interface checking is done for ordinary procedures
and procedure pointers as actual arguments to dummy procedures. However, it is
missing for procedure-pointer components.


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