From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 629873858D39; Tue, 19 Sep 2023 13:15:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 629873858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695129307; bh=WZomOC0c/9ekaNLah26/b5BKfNjj0waD8wsl4Kzyz6k=; h=From:To:Subject:Date:From; b=jKTmN3nPgVwdmzUXAlbAn/WxwhSihiQ+48AmD/XXqrUoel/31e0q4YVJBmvi/PxTP JSp5uZbqQ+oexST0SlCA+f3apmSZ7RZngX4YifzQPGFJYfKVbJmZUmo3k+Vvt1FNzq 5zE8fjJjehmfD1+FcVwMWB6lkyCN/Cc5CTQKiQPA= From: "matthew.hambley at metoffice dot gov.uk" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matthew.hambley at metoffice dot gov.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111477 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 >=20 > implicit none >=20 > abstract interface > subroutine one_if() > implicit none > end subroutine one_if > end interface >=20 > procedure(one_if), pointer :: one_ptr =3D> null() >=20 > call one_proc( first ) > one_ptr =3D> first > call one_proc( one_ptr ) >=20 > contains >=20 > subroutine first() > implicit none > end subroutine first >=20 > subroutine one_proc( one ) >=20 > implicit none >=20 > procedure(one_if), pointer, intent(in) :: one >=20 > call one() >=20 > end subroutine one_proc >=20 > 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 argum= ent 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 v= alid target for the dummy pointer" and so it seems like both call forms should w= ork. Maybe someone has a more recent version of the standard which clarifies thi= s or maybe I've misunderstood the very dense standard-speak. For reference both Intel and IBM Fortrans do accept both call forms shown above.=