Skip to content

Commit

Permalink
[flang][OpenMP] Avoid captures of references to structured bindings
Browse files Browse the repository at this point in the history
Handle one more case missed in ad37c8694e.
  • Loading branch information
kparzysz committed Dec 21, 2023
1 parent 38c1ff8 commit 791200b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flang/lib/Lower/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,10 +2197,12 @@ static void genBodyOfTargetDataOp(
if (fir::isa_builtin_cptr_type(refType.getElementType())) {
converter.bindSymbol(*argSymbol, arg);
} else {
// Avoid capture of a reference to a structured binding.
const Fortran::semantics::Symbol *sym = argSymbol;
extVal.match(
[&](const fir::MutableBoxValue &mbv) {
converter.bindSymbol(
*argSymbol,
*sym,
fir::MutableBoxValue(
arg, fir::factory::getNonDeferredLenParams(extVal), {}));
},
Expand Down Expand Up @@ -2489,7 +2491,7 @@ static void genBodyOfTargetOp(
// Bind the symbols to their corresponding block arguments.
for (auto [argIndex, argSymbol] : llvm::enumerate(mapSymbols)) {
const mlir::BlockArgument &arg = region.getArgument(argIndex);
// Avoid capture of reference to a structured binding.
// Avoid capture of a reference to a structured binding.
const Fortran::semantics::Symbol *sym = argSymbol;
fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym);
extVal.match(
Expand Down

0 comments on commit 791200b

Please sign in to comment.