[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)

via flang-commits flang-commits at lists.llvm.org
Wed Nov 15 06:56:34 PST 2023


jeanPerier wrote:

> With the latest updates, my record shows that there is no more open comments for this PR. Please let me know if I missed anything. I will work on the LIT tests and push a commit for that soon.

Sounds right to me. I am testing your PR, and I have a few new comments (more about small features where procedure pointers are allowed and that were not covered by "local" TODO, so crash with the removal of high level TODOs).

Could you please add TODOs inside intrinisics that takes POINTERs arguments?

ASSOCIATED
```
   real, pointer, external :: p
  print *, associated(p)
end
```
Crashes at https://github.com/llvm/llvm-project/blob/6d858e2ad3502f787d3a51fb3d69139686812703/flang/lib/Optimizer/Builder/IntrinsicCall.cpp#L2057


C_FUNCLOC

```
  use iso_c_binding
  real, pointer, external :: p
  call test(c_funloc(p))
end
```
Crashes at https://github.com/llvm/llvm-project/blob/6d858e2ad3502f787d3a51fb3d69139686812703/flang/lib/Optimizer/Builder/IntrinsicCall.cpp#L2310

NULLIFY (it is not an intrinsic, but rather a statement)
```
  real, pointer, external :: p
  nullify(p)
end
```
Crashes at https://github.com/llvm/llvm-project/blob/718793ce6a54b8fb95884d7fb37f70fd339cab3b/flang/lib/Lower/Bridge.cpp#L3098


The following intriniscs takes pointer arguments but OK for now (hits TODO):
- C_F_PROCPOINTER is OK, it is not yet implemented.
- NULL(P) is fine for now (special handling before IntrinsicCall.cpp, or caught by the "lowering function references that return procedure pointers to HLFIR" TODO). For reference will need handling at https://github.com/llvm/llvm-project/blob/6d858e2ad3502f787d3a51fb3d69139686812703/flang/lib/Optimizer/Builder/IntrinsicCall.cpp#L4517 when implementing the ProcRef TODO.

These are all the intrinsics taking procedure pointers I could think of.

https://github.com/llvm/llvm-project/pull/70461


More information about the flang-commits mailing list