Skip to content

[Flang] Incorrect diagnostic on procedure pointer actual argument #126950

@DanielCChen

Description

@DanielCChen

Consider the following code:

module m
    contains

    function genF1 (i)
        procedure (real), pointer :: genF1
        integer :: i
    end function
end module

program fmisc043a
use m
    call test1(genF1(1))

    contains
    subroutine test1 (p)
        procedure(real), pointer :: p
    end subroutine
end

Flang is currently issue an error as

error: Semantic errors in t3.f
./t3.f:12:16: error: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
      call test1(genF1(1))
                 ^^^^^^^^

The standard explicitly allows such a usage as [24-007: 15.5.2.10]

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.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions