public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64508] New: [F03] interface check missing for procedure pointer component as actual argument
Date: Tue, 06 Jan 2015 10:11:00 -0000	[thread overview]
Message-ID: <bug-64508-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-01-06 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06 10:11 janus at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-64508-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).