Skip to content

Commit f92309a

Browse files
authored
[flang][runtime] Workaround cuda-11.8 compilation issue. (#68459)
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.
1 parent d4feffb commit f92309a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flang/runtime/assign.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,12 @@ RT_API_ATTRS static void Assign(
263263
}
264264
std::size_t toElementBytes{to.ElementBytes()};
265265
std::size_t fromElementBytes{from.ElementBytes()};
266-
auto isSimpleMemmove{[&]() {
266+
// The following lambda definition violates the conding style,
267+
// but cuda-11.8 nvcc hits an internal error with the brace initialization.
268+
auto isSimpleMemmove = [&]() {
267269
return !toDerived && to.rank() == from.rank() && to.IsContiguous() &&
268270
from.IsContiguous() && toElementBytes == fromElementBytes;
269-
}};
271+
};
270272
StaticDescriptor<maxRank, true, 10 /*?*/> deferredDeallocStatDesc;
271273
Descriptor *deferDeallocation{nullptr};
272274
if (MayAlias(to, from)) {

0 commit comments

Comments
 (0)