[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)
Daniel Chen via flang-commits
flang-commits at lists.llvm.org
Mon Nov 6 12:47:16 PST 2023
================
@@ -325,10 +327,16 @@ fir::ExtendedValue Fortran::lower::genCallOpAndResult(
// compatible interface in Fortran, but that have different signatures in
// FIR.
if (funcPointer) {
- operands.push_back(
- funcPointer.getType().isa<fir::BoxProcType>()
- ? builder.create<fir::BoxAddrOp>(loc, funcType, funcPointer)
- : builder.createConvert(loc, funcType, funcPointer));
+ if (isProcPtr) {
+ funcPointer = builder.create<fir::LoadOp>(loc, funcPointer);
+ auto boxProcTy{fir::BoxProcType::get(builder.getContext(), funcType)};
+ auto func{builder.createConvert(loc, boxProcTy, funcPointer)};
+ operands.push_back(builder.create<fir::BoxAddrOp>(loc, funcType, func));
----------------
DanielCChen wrote:
Accepted. Changed to
```
if (funcPointer) {
if (isProcPtr)
funcPointer = builder.create<fir::LoadOp>(loc, funcPointer);
operands.push_back(
funcPointer.getType().isa<fir::BoxProcType>()
? builder.create<fir::BoxAddrOp>(loc, funcType, funcPointer)
: builder.createConvert(loc, funcType, funcPointer));
}
```
https://github.com/llvm/llvm-project/pull/70461
More information about the flang-commits
mailing list