public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64508] New: [F03] interface check missing for procedure pointer component as actual argument
@ 2015-01-06 10:11 janus at gcc dot gnu.org
  2015-01-06 12:38 ` [Bug fortran/64508] " janus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-06 10:11 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-11 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 10:11 [Bug fortran/64508] New: [F03] interface check missing for procedure pointer component as actual argument janus at gcc dot gnu.org
2015-01-06 12:38 ` [Bug fortran/64508] " janus at gcc dot gnu.org
2015-01-11 17:32 ` janus at gcc dot gnu.org
2015-01-11 17:34 ` janus at gcc dot gnu.org
2015-01-11 17:35 ` janus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).