diff options
author | jeanPerier <jperier@nvidia.com> | 2024-02-15 09:06:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-15 09:06:42 +0100 |
commit | e769fb8699e3fa8e40623764f7713bfc783b0330 (patch) | |
tree | d273c92a5c6020755d19a75fd85d09e4eb8523db /flang/lib/Lower/Bridge.cpp | |
parent | 0d0bd3ef55a2317c4254e97a3657e702bcf22214 (diff) | |
download | llvm-e769fb8699e3fa8e40623764f7713bfc783b0330.zip llvm-e769fb8699e3fa8e40623764f7713bfc783b0330.tar.gz llvm-e769fb8699e3fa8e40623764f7713bfc783b0330.tar.bz2 |
[flang] prevent legacy lowering from being called in pointer assignment (#81750)
When doing a pointer assignment with an RHS that is an array section,
the code fell in the legacy lowering code even with HLFIR enabled.
Escape this old code when HLFIR is on.
Should fix #80884.
Diffstat (limited to 'flang/lib/Lower/Bridge.cpp')
-rw-r--r-- | flang/lib/Lower/Bridge.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index 76e1272..2d7f748 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -3419,6 +3419,13 @@ private: fir::factory::disassociateMutableBox(*builder, loc, lhs); return; } + if (lowerToHighLevelFIR()) { + fir::ExtendedValue rhs = genExprAddr(assign.rhs, stmtCtx); + fir::factory::associateMutableBoxWithRemap(*builder, loc, lhs, rhs, + lbounds, ubounds); + return; + } + // Legacy lowering below. // Do not generate a temp in case rhs is an array section. fir::ExtendedValue rhs = Fortran::lower::isArraySectionWithoutVectorSubscript(assign.rhs) @@ -3427,7 +3434,7 @@ private: : genExprAddr(assign.rhs, stmtCtx); fir::factory::associateMutableBoxWithRemap(*builder, loc, lhs, rhs, lbounds, ubounds); - if (!lowerToHighLevelFIR() && explicitIterationSpace()) { + if (explicitIterationSpace()) { mlir::ValueRange inners = explicitIterSpace.getInnerArgs(); if (!inners.empty()) builder->create<fir::ResultOp>(loc, inners); |