[flang-commits] [flang] 791200b - [flang][OpenMP] Avoid captures of references to structured bindings

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu Dec 21 06:41:47 PST 2023


Author: Krzysztof Parzyszek
Date: 2023-12-21T08:41:30-06:00
New Revision: 791200b3bc6898f478138b63e91c03f0c68c7061

URL: https://github.com/llvm/llvm-project/commit/791200b3bc6898f478138b63e91c03f0c68c7061
DIFF: https://github.com/llvm/llvm-project/commit/791200b3bc6898f478138b63e91c03f0c68c7061.diff

LOG: [flang][OpenMP] Avoid captures of references to structured bindings

Handle one more case missed in ad37c8694e.

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 1acc49abb1da00..8ed31766725e14 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -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), {}));
             },
@@ -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(


        


More information about the flang-commits mailing list