From 9e65483d9cece12ce995010a20d21473816a1450 Mon Sep 17 00:00:00 2001 From: Slava Zakharin Date: Fri, 6 Oct 2023 16:14:06 -0700 Subject: [PATCH] [flang][runtime] Workaround cuda-11.8 compilation issue. 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. --- flang/runtime/assign.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 deferredDeallocStatDesc; Descriptor *deferDeallocation{nullptr}; if (MayAlias(to, from)) {