Skip to content

Commit 7ffad37

Browse files
committed
[flang][OpenMP] Avoid captures of references to structured bindings
Fixes build break caused by 400c32c.
1 parent 400c32c commit 7ffad37

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,38 +2489,38 @@ static void genBodyOfTargetOp(
24892489
// Bind the symbols to their corresponding block arguments.
24902490
for (auto [argIndex, argSymbol] : llvm::enumerate(mapSymbols)) {
24912491
const mlir::BlockArgument &arg = region.getArgument(argIndex);
2492-
fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*argSymbol);
2492+
// Avoid capture of reference to a structured binding.
2493+
const Fortran::semantics::Symbol *sym = argSymbol;
2494+
fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym);
24932495
extVal.match(
24942496
[&](const fir::BoxValue &v) {
2495-
converter.bindSymbol(*argSymbol,
2497+
converter.bindSymbol(*sym,
24962498
fir::BoxValue(arg, cloneBounds(v.getLBounds()),
24972499
v.getExplicitParameters(),
24982500
v.getExplicitExtents()));
24992501
},
25002502
[&](const fir::MutableBoxValue &v) {
25012503
converter.bindSymbol(
2502-
*argSymbol, fir::MutableBoxValue(arg, cloneBounds(v.getLBounds()),
2503-
v.getMutableProperties()));
2504+
*sym, fir::MutableBoxValue(arg, cloneBounds(v.getLBounds()),
2505+
v.getMutableProperties()));
25042506
},
25052507
[&](const fir::ArrayBoxValue &v) {
25062508
converter.bindSymbol(
2507-
*argSymbol, fir::ArrayBoxValue(arg, cloneBounds(v.getExtents()),
2508-
cloneBounds(v.getLBounds()),
2509-
v.getSourceBox()));
2509+
*sym, fir::ArrayBoxValue(arg, cloneBounds(v.getExtents()),
2510+
cloneBounds(v.getLBounds()),
2511+
v.getSourceBox()));
25102512
},
25112513
[&](const fir::CharArrayBoxValue &v) {
25122514
converter.bindSymbol(
2513-
*argSymbol, fir::CharArrayBoxValue(arg, cloneBound(v.getLen()),
2514-
cloneBounds(v.getExtents()),
2515-
cloneBounds(v.getLBounds())));
2515+
*sym, fir::CharArrayBoxValue(arg, cloneBound(v.getLen()),
2516+
cloneBounds(v.getExtents()),
2517+
cloneBounds(v.getLBounds())));
25162518
},
25172519
[&](const fir::CharBoxValue &v) {
2518-
converter.bindSymbol(*argSymbol,
2520+
converter.bindSymbol(*sym,
25192521
fir::CharBoxValue(arg, cloneBound(v.getLen())));
25202522
},
2521-
[&](const fir::UnboxedValue &v) {
2522-
converter.bindSymbol(*argSymbol, arg);
2523-
},
2523+
[&](const fir::UnboxedValue &v) { converter.bindSymbol(*sym, arg); },
25242524
[&](const auto &) {
25252525
TODO(converter.getCurrentLocation(),
25262526
"target map clause operand unsupported type");

0 commit comments

Comments
 (0)