[flang-commits] [flang] [flang][runtime] Workaround cuda-11.8 compilation issue. (PR #68459)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 6 16:35:46 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

<details>
<summary>Changes</summary>

cuda-11.8 nvcc cannot handle brace initialization of the lambda
object. 12.1 works okay, but I would like to have an option
to use 11.8.


---
Full diff: https://github.com/llvm/llvm-project/pull/68459.diff


1 Files Affected:

- (modified) flang/runtime/assign.cpp (+4-2) 


``````````diff
diff --git a/flang/runtime/assign.cpp b/flang/runtime/assign.cpp
index 458a1ba006b690e..237acb0c89fc2e3 100644
--- a/flang/runtime/assign.cpp
+++ b/flang/runtime/assign.cpp
@@ -263,10 +263,12 @@ RT_API_ATTRS static void Assign(
   }
   std::size_t toElementBytes{to.ElementBytes()};
   std::size_t fromElementBytes{from.ElementBytes()};
-  auto isSimpleMemmove{[&]() {
+  // The following lambda definition violates the conding style,
+  // but cuda-11.8 nvcc hits an internal error with the brace initialization.
+  auto isSimpleMemmove = [&]() {
     return !toDerived && to.rank() == from.rank() && to.IsContiguous() &&
         from.IsContiguous() && toElementBytes == fromElementBytes;
-  }};
+  };
   StaticDescriptor<maxRank, true, 10 /*?*/> deferredDeallocStatDesc;
   Descriptor *deferDeallocation{nullptr};
   if (MayAlias(to, from)) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/68459


More information about the flang-commits mailing list