Issue 126950
Summary [Flang] Incorrect diagnostic on procedure pointer dummy argument
Labels flang:frontend
Assignees
Reporter 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.
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to