public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matthew.hambley at metoffice dot gov.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/111477] New: Procedure as actual argument fails against procedure pointer dummy argument
Date: Tue, 19 Sep 2023 13:15:06 +0000 [thread overview]
Message-ID: <bug-111477-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111477
Bug ID: 111477
Summary: Procedure as actual argument fails against procedure
pointer dummy argument
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: matthew.hambley at metoffice dot gov.uk
Target Milestone: ---
Test case:
> program test
>
> implicit none
>
> abstract interface
> subroutine one_if()
> implicit none
> end subroutine one_if
> end interface
>
> procedure(one_if), pointer :: one_ptr => null()
>
> call one_proc( first )
> one_ptr => first
> call one_proc( one_ptr )
>
> contains
>
> subroutine first()
> implicit none
> end subroutine first
>
> subroutine one_proc( one )
>
> implicit none
>
> procedure(one_if), pointer, intent(in) :: one
>
> call one()
>
> end subroutine one_proc
>
> end program test
This fails to compile the call to "one_proc( first )" but succeedes on the call
to "one_proc( one_ptr )".
Consulting with BS ISO/IEC 1539-1:2010 section 12.5.2.9 "Actual arguments
associated with dummy procedure entities", paragraph 5 says:
"If a dummy argument is a procedure pointer, the corresponding actual argument
shall be a procedure pointer, a reference to a function that returns a
procedure pointer, a reference to the intrinsic function NULL, or a valid
target for the dummy pointer in a pointer assignment statement."
It seems like a procedure with the correct calling signature should be "a valid
target for the dummy pointer" and so it seems like both call forms should work.
Maybe someone has a more recent version of the standard which clarifies this or
maybe I've misunderstood the very dense standard-speak.
For reference both Intel and IBM Fortrans do accept both call forms shown
above.
reply other threads:[~2023-09-19 13:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-111477-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).