public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/111477] New: Procedure as actual argument fails against procedure pointer dummy argument
@ 2023-09-19 13:15 matthew.hambley at metoffice dot gov.uk
0 siblings, 0 replies; only message in thread
From: matthew.hambley at metoffice dot gov.uk @ 2023-09-19 13:15 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-19 13:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19 13:15 [Bug fortran/111477] New: Procedure as actual argument fails against procedure pointer dummy argument matthew.hambley at metoffice dot gov.uk
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).