@@ -2489,38 +2489,38 @@ static void genBodyOfTargetOp(
2489
2489
// Bind the symbols to their corresponding block arguments.
2490
2490
for (auto [argIndex, argSymbol] : llvm::enumerate (mapSymbols)) {
2491
2491
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);
2493
2495
extVal.match (
2494
2496
[&](const fir::BoxValue &v) {
2495
- converter.bindSymbol (*argSymbol ,
2497
+ converter.bindSymbol (*sym ,
2496
2498
fir::BoxValue (arg, cloneBounds (v.getLBounds ()),
2497
2499
v.getExplicitParameters (),
2498
2500
v.getExplicitExtents ()));
2499
2501
},
2500
2502
[&](const fir::MutableBoxValue &v) {
2501
2503
converter.bindSymbol (
2502
- *argSymbol , fir::MutableBoxValue (arg, cloneBounds (v.getLBounds ()),
2503
- v.getMutableProperties ()));
2504
+ *sym , fir::MutableBoxValue (arg, cloneBounds (v.getLBounds ()),
2505
+ v.getMutableProperties ()));
2504
2506
},
2505
2507
[&](const fir::ArrayBoxValue &v) {
2506
2508
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 ()));
2510
2512
},
2511
2513
[&](const fir::CharArrayBoxValue &v) {
2512
2514
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 ())));
2516
2518
},
2517
2519
[&](const fir::CharBoxValue &v) {
2518
- converter.bindSymbol (*argSymbol ,
2520
+ converter.bindSymbol (*sym ,
2519
2521
fir::CharBoxValue (arg, cloneBound (v.getLen ())));
2520
2522
},
2521
- [&](const fir::UnboxedValue &v) {
2522
- converter.bindSymbol (*argSymbol, arg);
2523
- },
2523
+ [&](const fir::UnboxedValue &v) { converter.bindSymbol (*sym, arg); },
2524
2524
[&](const auto &) {
2525
2525
TODO (converter.getCurrentLocation (),
2526
2526
" target map clause operand unsupported type" );
0 commit comments